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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.