Forum Discussion
Month on month percentage changes
Dear All,
Requesting your assistance, i have created a measure to calculate total sales / and also previous month sales, I have a date table, relationships are created, in my slicer i have Financial year / Month / Product and i want a matrix visual or a graph showing trend of last year or so.
Issue:
1) By using the values which gets computed shows only for the month which is selected in the slicer, it gives -100% error for all the months, it works only when the the invidual month is selected. Pls let me know what wrong i am doing.
2)I wanted to show a visual which shows the months and the respective Growth %,
3) By using the measure which you suggest, can i get the values ie Growth % at category level also.
Measure for total sales:
Growth %
Hi santoshlearner2 - First create a clean Total Sales measure
Total Sales =
SUM ( Sales[SalesAmount] )Now create a previous month sale:
Previous Month Sales =
CALCULATE (
[Total Sales],
DATEADD ( DIMDatesQ[Date], -1, MONTH )
)Hree we used DATEADD.
Last measure for growth calculation as below:
Growth % =
DIVIDE ( [Total Sales] - [Previous Month Sales], [Previous Month Sales] )Hope this helps
- Use PARALLELPERIOD instead of DATEADD to get previous month values reliably across slicers.
- Wrap your MoM % like this to avoid -100% errors:
MoM Growth % = IF(
ISBLANK([Previous Month Sales]),
BLANK(),
DIVIDE([Total Sales] - [Previous Month Sales], [Previous Month Sales])
)- Works in matrix or line chart with Month on axis and Product or Category as legend.
- For category-level MoM %, use ALLEXCEPT(Product, Product[Category]) inside CALCULATE.Hello Sir,
Superb, thank you.
6 Replies
- rajendraongole1
Super User
Hi santoshlearner2 - First create a clean Total Sales measure
Total Sales =
SUM ( Sales[SalesAmount] )Now create a previous month sale:
Previous Month Sales =
CALCULATE (
[Total Sales],
DATEADD ( DIMDatesQ[Date], -1, MONTH )
)Hree we used DATEADD.
Last measure for growth calculation as below:
Growth % =
DIVIDE ( [Total Sales] - [Previous Month Sales], [Previous Month Sales] )Hope this helps
- Shahid12523
Community Champion
- Use PARALLELPERIOD instead of DATEADD to get previous month values reliably across slicers.
- Wrap your MoM % like this to avoid -100% errors:
MoM Growth % = IF(
ISBLANK([Previous Month Sales]),
BLANK(),
DIVIDE([Total Sales] - [Previous Month Sales], [Previous Month Sales])
)- Works in matrix or line chart with Month on axis and Product or Category as legend.
- For category-level MoM %, use ALLEXCEPT(Product, Product[Category]) inside CALCULATE.- santoshlearner2
Resolver II
Hi
Superb, thank you.
- Ashish_Mathur
Super User
Hi,
Ensure that there is a relationship (Many to One and Single) from the Date column of the fACt table to the Date column of the Calendar table. Also, to your visual, drag Year and Month name from the Calendar table. This simple pattern should work
Measure = sum(Data[sales])
PM = calculate([Measure],previousmonth(calendar[date]))
Hope this helps.
- santoshlearner2
Resolver II
Hello Sir,
Superb, thank you.
- Ashish_Mathur
Super User
You are welcome.