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
Red
Frequent Visitor

Aggregating Measure - Performance problem

Hi All.

I have tested for many hours and can't figure out how to make this measure.. Its suppose to show how much we have in the warehouse at a given time and it has to be based on a ItemLedgerTable, which only stores the warehouse change of an item, example 
Monday : +10,
Tuesday : -1,
Wednesday : +8,
Thursday : +7.

This forces me to make a measure that aggregates all the rows. So that it gives me:
Monday : 10
Tuesday : 9
Wednesday : 17
Thursday : 24
and so on..

The table has 935 000 rows ( and I cant filter them away, since all rows need to be countet to have a complete view of the warehouse).

------

What I have is:

Measure =

VAR PrevDay =

CALCULATE (

LASTDATE ( 'Calendar'[Date] ),

FILTER (

ALL ( 'Calendar'[Date] ),

'Calendar'[Date] < MAX ( 'Calendar'[Date] )

)

)

 

VAR res =

CALCULATE(

SUM('ItemLedgerTable'[Quantity]),
'Calendar'[Date] <= PrevDay)

 

RETURN IF(res< 0, 0 , res)

 

My "solution" works fine, but its so demanding for PowerBI Services that I get an error.
This seems so simple but i just cant make it faster. Does anyone have any experience or know of some tricks? It would be greatly appreciated.

1 REPLY 1
v-zhangti
Community Support
Community Support

Hi, @Red 

 

I simulated some data, hoping to recover your problem.

Simple measure:

Measure = 
    CALCULATE (
        SUM ( 'Table'[Quantity] ),
        FILTER ( ALL ( 'Table' ), [Date] <= MAX( ( 'Table'[Date] ) )
    )
)

vzhangti_0-1638155574935.png

Please refer to the following pbix documents.

 

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

 

Best Regards,

Community Support Team _Charlotte

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.