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.
After setting an anchor date of 12/31/2018 for a particular report on income and expenses, a field referencing the "prior year" did not work as expected. The time dimension in the measure looks like this:
Date[YearKey]=YEAR(TODAY()-1)
The function TODAY, however, still renders the current year (2019) despite the anchor date setting (which is logical, no doubt), so this time referene still gives 2018 values.
This measure gives me the year I am looking for:
Last Year Prior to Anchor Year = YEAR(LASTDATE(Date[DateKey]))
LASTDATE picks up the anchor date, but when I use it in a measure to calculate income/expenses (
A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
Any help appreciated.
Solved! Go to Solution.
Modify your measure like below and check if it can meet your requirement:
Income = CALCULATE ( [Income], SAMEPERIODLASTYEAR ( Table_BasicCalendarUS[DateKey] ) )
Regards,
Jimmy Tao
See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
Greg:
I looked at your very interesting TITHW solution. It's a lot for us ordinary folks to get our heads around. I'll have to spend some time with it.
In the meanwhile, any thought on why something like this does not work:
Income = CALCULATE ( [Income], DATESBETWEEN ( Table_BasicCalendarUS[DateKey], NEXTDAY ( SAMEPERIODLASTYEAR ( LASTDATE ( Table_BasicCalendarUS[DateKey] ) ) ), LASTDATE ( Table_BasicCalendarUS[DateKey] ) ) )
This measure is on a page where the anchor date is set to 12/31/2018 and LASTDATE returns 12/31/2018 as a result. The intent here is to show the 2017 results, but it is clearly not working as intended.
Modify your measure like below and check if it can meet your requirement:
Income = CALCULATE ( [Income], SAMEPERIODLASTYEAR ( Table_BasicCalendarUS[DateKey] ) )
Regards,
Jimmy Tao
Jimmy:
Thanks very much. Worked perfectly.
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 |
---|---|
106 | |
93 | |
75 | |
62 | |
50 |
User | Count |
---|---|
147 | |
107 | |
105 | |
87 | |
61 |