Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Can someone help me with a simple formula to calcualte the value of the last year (which is YYYY number not a full date) ?
I tried the following formual but it isn't returning any values:
LY = Calculate(AVERAGE(Table[Value]), FILTER(ALL(Table), Table[YEAR] = Table[YEAR]-1))
Solved! Go to Solution.
The question is: "what do you want to see at the grand total"? Showing the value for 2012 looks a good compromise, but if you want to fix it, you first need to decide what to show there. At the grand total - being no year in the selection - the very value of "last year" is undefined.
Have fun with DAX!
Alberto Ferrari
http://www.sqlbi.com
That's what I want to get which SivaMani solution allowed me to get it:
Makes sense ?
Is there a measure can do that ? if yes, which one is better/faster ?
Only thing i see your formula is missing to work is a MAX call:
LY = Calculate(AVERAGE(Table[Value]), FILTER(ALL(Table), Table[YEAR] = MAX ( Table[YEAR] ) -1 ) )
Thanks a lot! it worked but the LY total is not correct:
Can the totoal be fixed ?
The total is showing LY value of 2012. Because you have used MAX in your DAX. so, it picks Max(Year).
Just Create a calculated measure with following formula,
Last Year = LOOKUPVALUE(Table3[Value],Table3[Year],Table3[Year]-1)
you will get the required Value.
Thanks,
Siva
I got this error:
A single value for column 'Year' in table 'Table' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
Works fine now! Thanks a lot!
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 22 | |
| 18 | |
| 18 | |
| 17 | |
| 13 |
| User | Count |
|---|---|
| 61 | |
| 53 | |
| 47 | |
| 40 | |
| 38 |