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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jmillar
Helper I
Helper I

Running totals by week (lifetime)

I have a transaction table joined to a date table.  The date table has a calculated "Week Start" column.  I need a running total of Qty, by week, from the beginning of time.  It's a mini-MRP solution, and I'm looking at inventory quantities, purchases orders and scheduled job consumption.  I'm using the following measure:

 

Qty Demand:=VAR MaxDate = MAX ( 'Calendar'[WeekStart] ) -- Saves the last visible date

RETURN

CALCULATE (

SUM(MRP[TransQty]), -- Computes sales amount

FILTER(ALL('Calendar'),'Calendar'[Date] <= MaxDate) -- Where date is before the last visible date

)

 

However, it just hangs.  Any suggestions?

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @jmillar ,

To calculate the running total, the source table needs a date column and create relationships with your Calendar table based on this case. 

If the source table does not have a date column, the measure would just only calculate the sum value of all the source table fields.

total.png

 

Best Regards,
Community Support Team _ Yingjie Li
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

2 REPLIES 2
v-yingjl
Community Support
Community Support

Hi @jmillar ,

To calculate the running total, the source table needs a date column and create relationships with your Calendar table based on this case. 

If the source table does not have a date column, the measure would just only calculate the sum value of all the source table fields.

total.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

wdx223_Daniel
Super User
Super User

Qty Demand:=VAR MaxDate = MAX ( 'Calendar'[WeekStart] ) -- Saves the last visible date

RETURN

CALCULATE (

SUM(MRP[TransQty]), -- Computes sales amount

'Calendar'[Date] <= MaxDate -- Where date is before the last visible date

)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors