Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
stuggling to get the below formula to work and as it is shows blanks...
Solved! Go to Solution.
Would be easier to diagnose with a demo pbix file (remove sensitive data).
I think however you're hitting an issue because in FILTER(TABLE, [FIELD] <> 0) you're putting the whole table into the filter context, which has the originally selected dates and then another filter with last years dates.
Try:
CALCULATE(
AVERAGE( TableName[FIELD] ),
SAMEPERIODLASTYEAR( Dates[Date] ),
TableName[FIELD] <> 0
)
If you specifically need the:
FILTER(ALL(Dates),Dates[Year]=max(Dates[Year])-1), SAMEPERIODLASTYEAR(Dates[Date]) that can go back in safely however I think the above should work in most situations where a year exists in the filter context already.
Other thoughts:
Would be easier to diagnose with a demo pbix file (remove sensitive data).
I think however you're hitting an issue because in FILTER(TABLE, [FIELD] <> 0) you're putting the whole table into the filter context, which has the originally selected dates and then another filter with last years dates.
Try:
CALCULATE(
AVERAGE( TableName[FIELD] ),
SAMEPERIODLASTYEAR( Dates[Date] ),
TableName[FIELD] <> 0
)
If you specifically need the:
FILTER(ALL(Dates),Dates[Year]=max(Dates[Year])-1), SAMEPERIODLASTYEAR(Dates[Date]) that can go back in safely however I think the above should work in most situations where a year exists in the filter context already.
Other thoughts:
bcdobbs you are a rockstar ! thanks this worked exactly as you said.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
97 | |
79 | |
67 | |
60 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |