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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
snph1777
Helper V
Helper V

Microsoft Power BI DAX - Running (Moving) Total within groups and sub-groups, WITHOUT Date dimension

I have an interesting situation in which I need to develop running (moving) totals without Time Intelligence.

 

I do not have a special Date dimension table in my Power BI data model.

 

See the source table below:

 

ts1.GIF

 

I have a measure:

 

TotalLaptops = SUM(TableSource[Laptops])

 

I need to develop a running total, which is only partially date related. I have DeliveryDates that spread across years. I need to get the cumulative sum taking each of the 3 groups to account without worrying about how the dates spread across months, or even years. However, the order of the dates is important for the cumulative total (obviously).

 

I need a new measure called [LaptopRunningTotal].

 

ts2.GIF

 

Any idea on how to develop the new measure?

 

 

 

LaptopRunningTotal = CALCULATE (

                                 [TotalLaptops],

                                  FILTER (

                                          ALL(TableSource),

                                          TableSource[DeliveryDate] <= MAX(TableSource[DeliveryDate])
                                                               &&
                                          TableSource[Group1] = MAX(TableSource[Group1])
                                                               &&
                                          TableSource[Group2] = MAX(TableSource[Group2])
                                                               &&
                                          TableSource[Group3] = MAX(TableSource[Group3])

                                        )

                                )

 

 

 

Is this one above okay ? Am not sure whether the above is fool-proof, please let me know.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@snph1777 , This one seem fine. If you want filters to work use allselected

 

LaptopRunningTotal = CALCULATE (
[TotalLaptops],
FILTER (
allselected (TableSource),
TableSource[DeliveryDate] <= MAX(TableSource[DeliveryDate])
&&
TableSource[Group1] = MAX(TableSource[Group1])
&&
TableSource[Group2] = MAX(TableSource[Group2])
&&
TableSource[Group3] = MAX(TableSource[Group3])
)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@snph1777 , This one seem fine. If you want filters to work use allselected

 

LaptopRunningTotal = CALCULATE (
[TotalLaptops],
FILTER (
allselected (TableSource),
TableSource[DeliveryDate] <= MAX(TableSource[DeliveryDate])
&&
TableSource[Group1] = MAX(TableSource[Group1])
&&
TableSource[Group2] = MAX(TableSource[Group2])
&&
TableSource[Group3] = MAX(TableSource[Group3])
)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

thanks @amitchandak 

 

I will get back after updating the code

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors