Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Trade Metrics

Hi Vidas,
Forgive me if I can ask a question. Feel free to send me onto researching on PowerBi forums.

I am looking to show some trading metrics as attached




As an attempt to code this with new measures in Power BI I have created the following measures:
* $ Sales Capital Gain = IF('Report'[Sales Capital Gain]<0,'Report'[Sales Capital Gain],0)
* $ Sales Capital Loss = IF('Report'[Sales Capital Gain]>0,'Report'[Sales Capital Gain],0)
* Sales Capital Gain = IF('Report'[Sales Capital Gain]<0,1,0)
* Sales Capital Loss = IF('Report'[Sales Capital Gain]>0,1,0)

I have created a copy of your Sales Tab and deleted “Sales Days Since Latest Buy” & “Latest Sell Date” and inserted the above measures.

Whilst the above work and shows a split between Profits & Losses in separate columns and similar a “1” against a transaction in separate columns for Loss or gain I am having an issue in having a total of these 4 columns. As an example, the total gain is showing as a total, Say, as an example, $8,000 in the loss column and zero in the gain rather than $12,000 Gain and $4,000 loss columns

See attached report from PowerBI


Any guidance will be appreciated, however feel free to say if I am asking too much of you.



Comments

  • Hi,

    It appears to me that to solve what you want, you need to force calculation to some level, for example - Day + account + symbol. Now when you check "Sales Capital Gain" SCG, you are checking at the final SCG for selected period. If you would force that to specific Day + account + symbol, you would check one sales transaction as you probably want.
    Example:
    Sales Capital Gain =
    SUMX(Dates[Day]
    , SUMX(Account[Account]
    , SUMX(Symbol[Symbol
    , IF('Report'[Sales Capital Gain]<0,'Report'[Sales Capital Gain],0)
    )))

    Note - this code is not tested, just for you to get an idea.
  • Hi Vidas, the code has errors in it. Leave it with me and I will try to sort this out from this guidance. Thanks again for your support
  • CNH: I am interested in your progress particularly. I record all of my trades in Portfolio Slicer and use Power BI. Am interested in helping in any way I can.
  • Hi Mark, I've not progressed on this. The code suggested by Vidas didn't work for me and i haven't had time / skills to progress further. Any suggestions will be appreciated.
Sign In or Register to comment.