Forum Discussion
How to Combine Counts & Percentage Difference into one visual
- 5 years ago
Hi moonpie ,
I recommend to use a Line and clustered column chart to combine Count and Percentage Difference together in the same visual while Count for column values and Percentage Difference for line values. Besides, you don’t need to create measures for each year. One measure will do it for all years in the same visual. Please take below steps for reference.
First, create a new column to get Year value:
Year = VALUE(RIGHT('Fall'[Term],4))Then, create 2 measures like below:
Total count = COUNT('Fall'[ID]) % Diff = VAR currentYear = MAX(Fall[Year]) VAR previousCount = CALCULATE([Total count],ALL(Fall[Year]),Fall[Year] = currentYear - 1) RETURN DIVIDE([Total count] - previousCount, previousCount)Finally, create the visual using a Line and clustered column chart. You can use the Day slicer to display a different day.
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
- 5 years ago
moonpie Do you want the result like this?
I tested my % Diff measure and it works well as above, so could you please check again with it? Do you make any modifications to it?
There is no need to create two measures for the chart to display % Diff because it will calculate the value for each year dynamically according to Year. You could create a table like below to test this.
Additionally, if you want to use different measures to display % Diff 18-19 and % Diff 19-20 in the same table just like that in the first image, I used measures like below:
Total 2018 = CALCULATE([Total count],ALL(Fall[Year]),Fall[Year]=2018) Total 2019 = CALCULATE([Total count],ALL(Fall[Year]),Fall[Year]=2019) Total 2020 = CALCULATE([Total count],ALL(Fall[Year]),Fall[Year]=2020) % Diff 18-19 = DIVIDE([Total 2019] - [Total 2018], [Total 2018]) % Diff 19-20 = DIVIDE([Total 2020] - [Total 2019], [Total 2019])Hope this will be helpful.
moonpie Do you want the result like this?
I tested my % Diff measure and it works well as above, so could you please check again with it? Do you make any modifications to it?
There is no need to create two measures for the chart to display % Diff because it will calculate the value for each year dynamically according to Year. You could create a table like below to test this.
Additionally, if you want to use different measures to display % Diff 18-19 and % Diff 19-20 in the same table just like that in the first image, I used measures like below:
Total 2018 = CALCULATE([Total count],ALL(Fall[Year]),Fall[Year]=2018)
Total 2019 = CALCULATE([Total count],ALL(Fall[Year]),Fall[Year]=2019)
Total 2020 = CALCULATE([Total count],ALL(Fall[Year]),Fall[Year]=2020)
% Diff 18-19 = DIVIDE([Total 2019] - [Total 2018], [Total 2018])
% Diff 19-20 = DIVIDE([Total 2020] - [Total 2019], [Total 2019])
Hope this will be helpful.
Yes, There was a slight mistake in my measure.
Thank you very much for your assistance. It is greatly appreciated!