Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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?
Solved! Go to Solution.
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
)
)
@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.
@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.
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
)
)
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |