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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jimbobshandy
Frequent Visitor

Running Total that shouldn't work but does - please help explain!!

Thought I was getting my head around dax but this simple measure (on a model I've inherited) has bamboozled me as I don't think it should work correctly, but it does... I'm not satisfied accepting that it works, I really need to understand why!!

This is a running total for 'Finish' dates that has been placed on a scorecard. I want the measure to ignore any slicer filters on the Calendar[Year] - a connected date table (that is not marked as a date table).  When a user selects the year 2019, it still counts everything in up until 30 April 22 (e.g. counting items in 2019, 2020, 2021 and 2022) which is what I want... but how does it do this without an ALL(Calendar) ??? 

Calculate(count('Schedule'[Activity ID]),'Calendar'[Date]<=date(2022,4,30),'Schedule'[Date Type]="Finish")


It would appear that the bit in red is unaffected by the 2019 filter provided by the slicer. Is there something stopping filter transition? Just to confirm I've checked 'interactions' - the scorecard should defintely by effected by the slicer.

Thanks in advance, this is bugging me so much!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @jimbobshandy 
First of all, you have to remember that filters are in fact tables. And your code replaces the date filter (the VLAUES of 'Calendar'[Date] which is in fact a table) with a constant table containing all the dates from the start up to Apr. 30, 2022. In this case there is nothing that can can affect this table and no matter what you select it will remain the the same.

1.png

View solution in original post

3 REPLIES 3
jimbobshandy
Frequent Visitor

Hi @tamerj1 , thanks so much for the rapid response!

 

You've made that much clearer in my mind, I never thought of that as a table, so thank you.

Taking this a little further, the bit I was struggling with is why in this article there is a measure that uses an ALL() - see the bit i've highlighted in green. This was an approach I've always used but maybe this is largely redundant as I guess maybe this is explained by the section highlighted in red (I must admit I just noticed this!)? My model uses this approach - a datetime relationship - hence I can omit the ALL(). 

jimbobshandy_0-1652270208799.png

 

 Taken from: Computing running totals in DAX - SQLBI

Thanks again for your help 🙂

Absolutely correct

tamerj1
Super User
Super User

Hi @jimbobshandy 
First of all, you have to remember that filters are in fact tables. And your code replaces the date filter (the VLAUES of 'Calendar'[Date] which is in fact a table) with a constant table containing all the dates from the start up to Apr. 30, 2022. In this case there is nothing that can can affect this table and no matter what you select it will remain the the same.

1.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors