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
janen
Regular Visitor

Running total of measure

Hello, 

 

I am a fairly new user of PowerBI. I am stuck on this particular problem for 2 days. Any help or pointers would be appreciated. 

I am working on basic sales wherein I have created a measure of Total Transactions as:

 

Total Transactions = DISTINCTCOUNT('Sales Data'[OrderNumber])

 

Now, I want to create another measure called Cumulative Transactions Selected as:

 

Cumulative Transactions Selected = 
CALCULATE (
[Total Transactions],
FILTER( ALL ( 'Dates'[Date] ),
'Dates'[Date] <= MAX ( 'Dates'[Date] )))

 

It works fine only if I am selecting the first quarter:

pb1.png

 

 

 

Things go awry once I select other quarters:

pb2.png

 

 

I tried different variations of the formula like using ALLSELECTED so that it takes all the selected filters but I am not getting the desired results.

 

Thanks in advance for any help :).

 

Update: Use the following formula:

 

Cumulative Transactions Selected =
CALCULATE (
[Total Transactions](
FILTER( ALL ( 'Dates'[Date] ),
Dates[Date] >= MIN ('Dates'[Date]) && Dates[Date] <= MAX( 'Dates'[Date]) )))

 

Works well when I select consecutive quarters but fails when I select non- consecutive quarters :(.

 

2 REPLIES 2
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @janen,

 

Can you share the pbix file? You can mask the private parts first. The formula seems good. It could be something wrong with the data model.

 

Best Regards,

Dale

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

Just an update: 

CALCULATE ([Total Transactions],
FILTER (ALL(Dates[Date]),
Dates[Date] <= MAX( Dates[Date])),
VALUES(Dates[Quarter & Year]))

 

I tried the above formula. This works fine but it resets after every quarter. So, if I select QUARTER1 and QUARTER2 it will reset my calculations after QUARTER1 and restart again. 

 

 

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.