Forum Discussion
Anonymous
7 years agoNot applicable
Show % difference between lines in a chart with tooltips
Hello, I have the following data in a line Chart, it has all months of 2017 and just 9 months in 2018. How can i display the sales difference in percentage between the years by month? T...
- 7 years ago
Hi Anonymous,
For another way, we could use dax to achieve that.
Measure =
CALCULATE ( SUM ( Table1[Sales] ) )
- CALCULATE ( SUM ( Table1[Sales] ), SAMEPERIODLASTYEAR ( 'Table1'[Year] ) )More details, you could refer to the attachment.
Best Regards,
Cherry
Anonymous
7 years agoNot applicable
Hi Anonymous
Here are the steps I used to create to get that:
- open your query editor
- add a merged column to concatenate MONTH_YEAR
- sort on this column
- add two indexes, one from 0 and one for 1
- use the function Merge queries as follows
- expand the selection by keeping MONTH and SALES
- add a conditional column SAME MONTH to know if the next line of your current line refers to the same month
- add a custom column RESULT saying that IF the next line refers to the same month then substract
Then you get that:
Regards,
CR