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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
msuser48
Helper I
Helper I

Count rows for each ID and aggregate

I have this sample table:

IdDateProductRunning Total
12017-01-0103
22018-01-0103
32019-01-0103
42017-01-0116
52020-01-0116
62021-01-0116
72021-01-0127
82022-01-0138
92022-01-0149
102017-01-01511
112022-01-01511

 

"Running Total" is a MEASURE (NOT a column), and I need to change this measure such that it works when the date column is filtered.

 

Current code for "Running Total", which generates the above output:

msuser48_0-1670160797214.png

 

Issue with the code: It does not work when the "date" column is filtered using a slicer.

 

I need this output when the date filter is set to 2018-01-01-2023-01-01 for example:

IdDateProductRunning Total
22018-01-0102
32019-01-0102
52020-01-0114
62021-01-0114
72021-01-0125
82022-01-0136
92022-01-0147
112022-01-0158

 

As you can see, 2017 dates are removed, therefore the "Running Total" measure is adjusted accordingly.

 

How to achieve this?

1 ACCEPTED SOLUTION

ALLSELECTED did the trick.

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@msuser48 You will need to use ALLEXCEPT instead of ALL. Also, this might be of interest: https://community.powerbi.com/t5/Quick-Measures-Gallery/Better-Running-Total/m-p/2755666#M885



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 
can you elaborate how the allexcept should look like? I tried AllExcept(table,product), which still does not work.

ALLSELECTED did the trick.

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors