Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
133 | |
76 | |
53 | |
38 | |
37 |
User | Count |
---|---|
203 | |
81 | |
71 | |
55 | |
48 |