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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jajaAtPowerbi
Frequent Visitor

Why ALL is not working ?

jajaAtPowerbi_0-1691902043735.png

jajaAtPowerbi_2-1691902195851.png

 

jajaAtPowerbi_1-1691902109040.png

 

would like to calculate the member count for the same period of last month, expect ALL will remove the filter context at Calendar, but seem no.

 

Could you teach how to fix the problem?

2 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @jajaAtPowerbi 
Please try

redeemed member count (same period LM) =
VAR StartDateLM = [start date LM]
VAR EndDateLM = [end date LM]
RETURN
    CALCULATE (
        [redeemed member count],
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] >= StartDateLM
                && 'Calendar'[Date] <= EndDateLM
        )
    )

View solution in original post

jajaAtPowerbi
Frequent Visitor

@tamerj1 it works by creating a local variable inside measure redeemed member count (same period LM) but i do not understand the difference.

Would you mind explain why?

 Thanks you so much.

View solution in original post

3 REPLIES 3
jajaAtPowerbi
Frequent Visitor

@tamerj1 it works by creating a local variable inside measure redeemed member count (same period LM) but i do not understand the difference.

Would you mind explain why?

 Thanks you so much.

@jajaAtPowerbi 
Measures in a DAX formula impose context transition therefore, in the original formula there are evaluated in a filter context that is created by transforming the row context created by FILTER into a filter context by the measure reference. So each measure will be repeatedly re-evaluated for every iteration of the FILTER function.

 

However, variables are evaluated only once. If a measure is evaluated within the outer filter context and stored in a variable, the value of the variable will not be ultered (meaning the measure will not be re-evaluated) even if referenced inside an iterator, rather it will always keep the value of the very first evaluation.

tamerj1
Super User
Super User

Hi @jajaAtPowerbi 
Please try

redeemed member count (same period LM) =
VAR StartDateLM = [start date LM]
VAR EndDateLM = [end date LM]
RETURN
    CALCULATE (
        [redeemed member count],
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] >= StartDateLM
                && 'Calendar'[Date] <= EndDateLM
        )
    )

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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