Forum Discussion
Rolling Measure calculation
- 6 years ago
Hi NBOnecall ,
below is the solution I propose to you:
1) create a new calculated column in the Dimtime table to use in your matrix.
Year Month = year([Date])&" "&FORMAT('Dimtime'[Date],"mmmm")2) create a new calculated column in the Dimtime table to correctly sort the previous column
Year Month Order = value(year([Date])&FORMAT(month([Date]),"00"))
3) Create 2 new measures:
GMROII rolling last 12 months = VAR currentDate = LASTDATE('Dimtime'[Date]) VAR sameDateLastYear = NEXTDAY(SAMEPERIODLASTYEAR(currentDate)) RETURN CALCULATE( [GMROII], DATESBETWEEN('Dimtime'[Date], sameDateLastYear, currentDate) )Turns rolling last 12 months = VAR currentDate = LASTDATE('Dimtime'[Date]) VAR sameDateLastYear = NEXTDAY(SAMEPERIODLASTYEAR(currentDate)) RETURN CALCULATE( [Turns], DATESBETWEEN('Dimtime'[Date], sameDateLastYear, currentDate) )You can find an updated version of your Power BI attached here:
https://drive.google.com/file/d/1644H9YhLfPuWbE9laXMfTQLf6T2KVvXn/view?usp=sharing
Let me know if it works!
LC
Interested in Power BI templates? Check my blog at www.finance-bi.com
Hi NBOnecall ,
I would need to understand the problem better to propose a solution, that's why I'd recommend sharing a sample Power BI file.
I understand that as it takes a long time, you'd rather avoid it.
Maybe someone else seeing this post can think of a solution without having more info.
Best of luck for finding a solution,
LC
https://www.dropbox.com/s/q438fxb6ogpp6nu/Test.pbix?dl=0
Let me know if this link works. As you can see I have a date slicer that I can pick the range of my dates. I would like to be able to output the 12 month dates in a matrix to show the change month by month always looking back a year.
Thank you!
- lc_finance6 years agoSolution Sage
Hi NBOnecall ,
below is the solution I propose to you:
1) create a new calculated column in the Dimtime table to use in your matrix.
Year Month = year([Date])&" "&FORMAT('Dimtime'[Date],"mmmm")2) create a new calculated column in the Dimtime table to correctly sort the previous column
Year Month Order = value(year([Date])&FORMAT(month([Date]),"00"))
3) Create 2 new measures:
GMROII rolling last 12 months = VAR currentDate = LASTDATE('Dimtime'[Date]) VAR sameDateLastYear = NEXTDAY(SAMEPERIODLASTYEAR(currentDate)) RETURN CALCULATE( [GMROII], DATESBETWEEN('Dimtime'[Date], sameDateLastYear, currentDate) )Turns rolling last 12 months = VAR currentDate = LASTDATE('Dimtime'[Date]) VAR sameDateLastYear = NEXTDAY(SAMEPERIODLASTYEAR(currentDate)) RETURN CALCULATE( [Turns], DATESBETWEEN('Dimtime'[Date], sameDateLastYear, currentDate) )You can find an updated version of your Power BI attached here:
https://drive.google.com/file/d/1644H9YhLfPuWbE9laXMfTQLf6T2KVvXn/view?usp=sharing
Let me know if it works!
LC
Interested in Power BI templates? Check my blog at www.finance-bi.com
- NBOnecall6 years agoHelper V
lc_financeIs there a trick to get the Year Month column in the matrix to be in the correct order. When I create it on my workbook it has it out of order.
Thank you,
Noel
- lc_finance6 years agoSolution Sage
HI NBOnecall ,
Yes, there is! You should choose the Year Month column, then go to Modeling -> Sort by column to custom sort it.
I just wrote a blog post about this: https://finance-bi.com/power-bi-learn-how-to-custom-sort-a-column/
Feel free to take a look at it, and let me know if anything is still unclear.
Regards,
LC