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.
Hello!
I'm stuck and it would be great if you Experts could help me.
I do have a measure which calculates the monthly rents. What I would need is a average bar for the last and the second to last year.
The measure to calculate the monthly rent for reference:
Solved! Go to Solution.
I managed to solve it my self, once I got inspired by amitchandak's solution. 🙂
Its
Average last year = CALCULATE(SUM('Erlöse'[Betrag])/12;PREVIOUSYEAR(Datumstabelle[Date]);'Erlöse'[Positionsart] IN { "Miete" } )
and
Average second to last year = CALCULATE(SUM('Erlöse'[Betrag])/12;PARALLELPERIOD(Datumstabelle[Date];-2;YEAR);'Erlöse'[Positionsart] IN { "Miete" } )
Simple as that... ^^
Thanks all
Hi @micsafdas ,
You need 2 measures as below:
Last 2 years average = CALCULATE(AVERAGE('Table'[Value]),FILTER(CALCULATETABLE(ALLSELECTED('Table'),ALL('Table'[Date])),'Table'[Date].[Year]=YEAR(MAX('Table'[Date]))-2))
Previous year average = CALCULATE(AVERAGE('Table'[Value]),FILTER(CALCULATETABLE(ALLSELECTED('Table'),ALL('Table'[Date])),'Table'[Date].[Year]=YEAR(MAX('Table'[Date]))-1))
Finally you will see :
For the related .pbix file,pls click here.
Best Regards,
Kelly
As I can't seem to be able to attach the graphic in the original post here what I am looking for.
In case you have date dimension
Last YTD complete Sales = CALCULATE(Avergae(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD complete Sales = CALCULATE(Avergae(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-2,Year)),"12/31"))
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
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
Thanks for your post! This seems promising, but I didn't get the expected result back.
I probably explained it not to the fully extent.
I need (looking from 2019) the average of 2018, namely from 01.01.18 - 31.12.18 and from 2017 (vice versa)
No year to date calculations.
Btw, I do have a date table. To give it some "flesh", I uploaded the basic pbix which translates to the big pbix.
https://www.dropbox.com/s/u4wmq7puu5mzl05/Showcase.pbix?dl=0
I would expect the "Previous Year Average" to be at 4333 in 2018, as the sum of 2017 is 52K.
Thanks also!
I couldn't get your code to work though. It doesn't seem to understand this part:
The [Year] seems to be the problem. Why so?
Thanks so far you two!
I managed to solve it my self, once I got inspired by amitchandak's solution. 🙂
Its
Average last year = CALCULATE(SUM('Erlöse'[Betrag])/12;PREVIOUSYEAR(Datumstabelle[Date]);'Erlöse'[Positionsart] IN { "Miete" } )
and
Average second to last year = CALCULATE(SUM('Erlöse'[Betrag])/12;PARALLELPERIOD(Datumstabelle[Date];-2;YEAR);'Erlöse'[Positionsart] IN { "Miete" } )
Simple as that... ^^
Thanks all
If you want sum first at month level and the Average
Avergaex(summarize(CALCULATETABLE('Erlöse', DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"), 'Erlöse'[Positionsart] IN { "Miete" })
,date[month-year],"_sum",SUM('Erlöse'[Betrag])),_sum)
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 |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |