Forum Discussion
Create own stacked line chart
- Anonymous7 years ago
Hi RemiAnthonise,
After having look of your sample data i have modified a little bit in you dax. Its working as 100% line chart. Have a look in pbix file and revert me if any concern.
https://drive.google.com/file/d/1u0cVD2Wu6K75dANlAqZROY-Zabfdfcf2/view?usp=sharing
Best Regards,
Ravi
I've tried the following measure
Percentage =
DIVIDE(CALCULATE(DISTINCTCOUNT(FactClient[ClientId]);DimAge[AgeCategory]);CALCULATE(DISTINCTCOUNT(FactClient[ClientId])))
DimAge[AgeCategory] is the category for which I want to calculate the total percentage. Unfortunately, this didn't work because this field is a text, because of the category 65 - older.
My idea was: do a distinctcount per AgeCategory based on ClientID and divide this by the total distinctcount based on ClientID. The total of this should be 100% (right?). Like I said before, this didn't work because the text field doesn't work in my filter.
Do you have any further ideas? My last option is trying to change all the AgeCategories but I want to avoid this.
- v-frfei-msft7 years ago
Community Support
Hi RemiAnthonise,
Could you please try to use ALLEXCEPT in your formula? Here the FactClient[column] should be the the column on the X-axis in your visual. If it doesn't work, kindly share your sample data to me.
Percentage = DIVIDE(CALCULATE(DISTINCTCOUNT(FactClient[ClientId]);DimAge[AgeCategory]);CALCULATE(DISTINCTCOUNT(FactClient[ClientId]),ALLEXCEPT(FactClient,FactClient[column])))
Regards,
Frank
- RemiAnthonise7 years ago
Helper V
Hi Frank v-frfei-msft
I still get the same error because of the AgeCategory filter. The X-axis is a DimDate, by the way.
Here is my pbix: https://www.dropbox.com/s/r1z1hrk73jx6di0/sample%20stacked%20line%20chart.pbix?dl=0
Short resume: there is a stacked bar chart on my page. I want to recreate this with a line chart. Not exactly the same as the stacked bar chart or any other visual: I want to show it as a percentage of 100% for that period. See image below. Total is always 100%.
If anything is unclear, please let me know.
- Anonymous7 years agoNot applicable
Hi RemiAnthonise,
After having look of your sample data i have modified a little bit in you dax. Its working as 100% line chart. Have a look in pbix file and revert me if any concern.
https://drive.google.com/file/d/1u0cVD2Wu6K75dANlAqZROY-Zabfdfcf2/view?usp=sharing
Best Regards,
Ravi