Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
lnz
Frequent Visitor

SUMX with measures expression for categories by date

Hi, guys

To calculate stocks portfolio yield dynamic I need to calculate my [Potfolio Total Value] for allselected stocks by date

 

I've made next measures:

  • [Asset Trade Price]
  • [Asset Trade Yield]
  • [Asset Current Amount]
  • [dev Asset Current Price] - I think this measure need some changes
  • [Asset Current Value] = [Asset Current Amount] * [dev Asset Current Price]
  • [Total Current Amount] - Total amount of shares in portfolio
  • [dev Portfolio Current Value] - Total value of portfolio

  

[dev Portfolio Current Value] code:

 

dev Portfolio Current Value = 
VAR d = MAX('calendar'[Date])
RETURN
    CALCULATE(
        SUMX(VALUES('split'[asset-id]);
           [Asset Current Value]
        );
        FILTER(
            ALL('calendar');
            'calendar'[Date] <= d
        )
    )

  

I expect to recive [dev Portfolio Current Value] = 206 359,50 at 16.11.2018 (16th November 2018)
But I've got 222 559,50 because [Asset Current Price] = 193,53 both for Apple and Facebook

 

How could I fix my formulas to sum [amount]*[price] for each asset-id per day

 

PBI Project Here

 

PBI.Community.Topic-0301.png

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@lnz,

 

Change it as follows.

VALUES ( company[ticker] )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@lnz,

 

Change it as follows.

VALUES ( company[ticker] )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.