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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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


@ 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!:
Mastering Power BI 2nd Edition

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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