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.
Hi,
Hoping someone can help. I have the below measure set up in my Power BI report -
YTD_Actual:=IF(ISFILTERED(Reporting_Periods[Year]),calculate(sum([VALUE]),filter(DWH_FACT_MAIN,[YearPeriodNumber] <= [MaxYearRP] && [TRANTYPE] ="ACTUALS"),ALLEXCEPT(Reporting_Periods,Reporting_Periods[YEAR])),BLANK())
I need to change this so that the filter reads > rather than >=, however when i have updated this it doesn't bring any data back whatsoever. It works fine with the <= though which i am struggling to understand why/how?
For information, YearPeriodNumber is a Sum column whereas MaxYearRP is a set up as a measure. In case that makes a difference.
Also, Year Period comes from the table DWH_Fact_Main whereas MaxYearRP is in another table called Reporting_Periods.
Any help is much appreciated.
Scott
Solved! Go to Solution.
Pull your MaxYearRP measure in the FILTER out into a variable up front. Using it there will trigger context transition and each period will be compared to see if it is less than itself which will return no rows.
YTD_Actual :=
VAR maxRP = [MaxYearRP]
RETURN
IF (
ISFILTERED ( Reporting_Periods[Year] ),
CALCULATE (
SUM ( [VALUE] ),
FILTER (
DWH_FACT_MAIN,
[YearPeriodNumber] < maxRP
&& [TRANTYPE] = "ACTUALS"
),
ALLEXCEPT (
Reporting_Periods,
Reporting_Periods[YEAR]
)
),
BLANK ()
)
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi @Anonymous ,
This is not helping much. If the condition change in your DAX is not returning any data, then there are not data rows for this condition.
Also, try sharing more details like sample data and screenshots:
Thanks,
Pragati
Hi,
There is definitely data there to be brought back, otherwise the <= wouldn't be working either.
So using <= currently brings back Periods 1-4, with 4 being the 'current' period. I want to bring back anything from closed periods i.e. before period 4, therefore need to change the logic to from <= to just <.
Please see attached screenshots before i make the change i.e. using <= and then after i make the change i.e. using <. You can see the charts and cards appear blank. It also affects some matrix tables i also use this field in.
Pull your MaxYearRP measure in the FILTER out into a variable up front. Using it there will trigger context transition and each period will be compared to see if it is less than itself which will return no rows.
YTD_Actual :=
VAR maxRP = [MaxYearRP]
RETURN
IF (
ISFILTERED ( Reporting_Periods[Year] ),
CALCULATE (
SUM ( [VALUE] ),
FILTER (
DWH_FACT_MAIN,
[YearPeriodNumber] < maxRP
&& [TRANTYPE] = "ACTUALS"
),
ALLEXCEPT (
Reporting_Periods,
Reporting_Periods[YEAR]
)
),
BLANK ()
)
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
25 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
30 | |
11 | |
11 | |
10 | |
6 |