Forum Discussion
Show last years result
Hello!
I'm trying to show results of last year and with some of my DAX it workes fine. Like this one:
I just added filter for -1 year, and it shows result for last year.
But on this one I can't get it to work
And when I add the kalendar filter it shows the result for 2022, but when I year filter to 2022 it shows blank in results.
I've tried alot of things that Power BI recommended, but couldn't find a solution to it.
All help is welcomed!
2 Replies
- amitchandak
Super User
Anonymous , Do not use [Date]. Year
Create a column for year in your date table and use that, Also mark Kalendar table as date table
example
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos. - AnonymousNot applicable
Hi Anonymous ,
You can refer the following links to get it:
powerbi - How to get the last year value based on filter selection?
Last Year = VAR LastYear = SELECTEDVALUE('Calendar - Fiscal Date'[FiscalYr Year Number]) -1 VAR LastYearValue = CALCULATE( [Line Amount (Formatted)], FILTER( ALL('Calendar - Fiscal Date'), 'Calendar - Fiscal Date'[FiscalYr Year Number] = LastYear ) ) return LastYearValueHow to calculate last year value in Power BI with DAX formulas?
If the above one can't help you get the expected result, please provide some raw data in your tables (exclude sensitive data) with Text format and your visual settings. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards