cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LaZZaNoVa-61
Helper III
Helper III

Filtered Dax not showing correct result

Hey everyone!

I've got the following two DAX formula:

UPO Downloads = COUNTROWS('OD - UPO Downloads')

Running Total UPO Downloads = var maxDate = MAX('Dates'[Date]) return CALCULATE( 'OD - UPO Downloads'[UPO Downloads], REMOVEFILTERS( 'Dates'), 'Dates'[Date] <= maxDate)


And I've got the following filter and card:
LaZZaNoVa61_0-1654002373802.png

 

The Running Total Formula seems to ignore my filter.
So my question is: How can I make my Running Total Formula work in combination with the filter?

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @LaZZaNoVa-61 

please try

Running Total UPO Downloads =
VAR maxDate =
    MAX ( 'Dates'[Date] )
VAR minDate =
    MINX ( ALLSELECTED ( 'Dates' ), 'Dates'[Date] )
RETURN
    CALCULATE (
        'OD - UPO Downloads'[UPO Downloads],
        REMOVEFILTERS ( 'Dates' ),
        'Dates'[Date] <= maxDate,
        'Dates'[Date] >= minDate
    )

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @LaZZaNoVa-61 

please try

Running Total UPO Downloads =
VAR maxDate =
    MAX ( 'Dates'[Date] )
VAR minDate =
    MINX ( ALLSELECTED ( 'Dates' ), 'Dates'[Date] )
RETURN
    CALCULATE (
        'OD - UPO Downloads'[UPO Downloads],
        REMOVEFILTERS ( 'Dates' ),
        'Dates'[Date] <= maxDate,
        'Dates'[Date] >= minDate
    )
Greg_Deckler
Super User
Super User

@LaZZaNoVa-61 Well, yes, you used REMOVEFILTER so that is going to blow away all filters on that table. Try:

Running Total UPO Downloads = 
var maxDate = MAX('Dates'[Date]) 
var minDate = MIN('Dates'[Date]) 
return CALCULATE( 'OD - UPO Downloads'[UPO Downloads], REMOVEFILTERS( 'Dates'), 'Dates'[Date] <= maxDate, 'Dates'[Date] >= minDate)

@ 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...

Hey Greg,

I've tried your Dax formula, but that one returns only the amount of downloads of the last day. (31-3-2022) 
Instead of a running total of the entire period.

Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors
Top Kudoed Authors