Forum Discussion
Month on Month - % Variance
Hello Guys
I need your help
I would like to create a chart in Power BI which shows the % of Variance Month over Month, but, I am not succeed.
in the table below I have the number of tickets closed every month. The column "Closed" is a measure.
Is there a way to calculate this?
| MonthYear | Closed | % |
| Jan-17 | 2811 | - |
| Feb-17 | 2591 | -8% |
| Mar-17 | 2986 | 15% |
| Apr-17 | 2775 | -7% |
| May-17 | 2737 | -1% |
| Jun-17 | 2814 | 3% |
| Jul-17 | 3189 | 13% |
| Aug-17 | 3957 | 24% |
| Sep-17 | 3130 | -21% |
Anonymous
The solution that Ashish_Mathur provided requires a full calendar date column in your data model. If you only have that "Month" column in your table, you should add a numeric "YearMonthNumber" column for this calculation. Please refer to sample below:
YearMonthNumber = VALUE(LEFT(FORMAT(Table3[MonthYear],"yyyyMMdd"),6))
variance% = IFERROR ( SUM ( Table3[Closed] ) / CALCULATE ( SUM ( Table3[Closed] ), FILTER ( ALL ( Table3 ), Table3[YearMonthNumber] = MAX ( Table3[YearMonthNumber] ) - 1 ) ) - 1, BLANK () )Regards,
7 Replies
- Ashish_MathurSuper User
Hi,
Try this
=IFERROR([Closed]/CALCULATE([Closed],PREVIOUSMONTH('CALENDAR'[Date]))-1,BLANK())
Hope this helps.
- AnonymousNot applicable
For some reason the number are not being displayed in the chart
THe measure is correct
- Ashish_MathurSuper User
Hi,
I will need to see your file. Share the download link.
- v-sihou-msftMicrosoft Employee
Anonymous
The solution that Ashish_Mathur provided requires a full calendar date column in your data model. If you only have that "Month" column in your table, you should add a numeric "YearMonthNumber" column for this calculation. Please refer to sample below:
YearMonthNumber = VALUE(LEFT(FORMAT(Table3[MonthYear],"yyyyMMdd"),6))
variance% = IFERROR ( SUM ( Table3[Closed] ) / CALCULATE ( SUM ( Table3[Closed] ), FILTER ( ALL ( Table3 ), Table3[YearMonthNumber] = MAX ( Table3[YearMonthNumber] ) - 1 ) ) - 1, BLANK () )Regards,
- PBIdashboardsPost Patron
The YearMonthNumber workaround in the accepted answer works when you don't have a Date table, but it breaks if your data spans multiple years 202312 and 202412 will be treated as consecutive months in the calculation.
Cleaner fix: add a proper Date table (even a simple one via Power Query) and use DATEADD:
Prev Month = CALCULATE([Closed], DATEADD('Date'[Date], -1, MONTH))
MoM % Variance = DIVIDE([Closed] - [Prev Month], ABS([Prev Month]))For teams reporting ticket volumes month-over-month regularly, Flexa Tables on AppSource adds MoM variance as a one-click button in the published report no DAX, no Date table dependency