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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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