Forum Discussion

Fusilier's avatar
Fusilier
Icon for Helper III rankHelper III
2 years ago
Solved

Sort 100% stacked bar chart for survey

Hi, hope somebody can help? I have some survey data I'm trying to analyse. Response to a question is either: Fairly safe Fairly unsafe Neither safe nor unsafe Very safe Very unsafe   And the...
  • Ritaf1983's avatar
    2 years ago

    Hi Fusilier 
    If you need to sort the stacked graph by its "slices"  you need to create separate measures for every group at the legend like :

    Fairly safe = CALCULATE(COUNTROWS('Table'),'Table'[answer]="Fairly safe")
    Fairly unsafe = CALCULATE(COUNTROWS('Table'),'Table'[answer]="Fairly unsafe")
    Neither safe nor unsafe = CALCULATE(COUNTROWS('Table'),'Table'[answer]="Neither safe nor unsafe")

    Then you can select by which group you want to sort the graph :

    The pbix with the example is attached
    P.s It's important to note that stacked graphs are complex to read and not really effective for data visualization. I'm attaching a link to my article on the subject, including an alternative.

    https://www.madeiradata.com/post/home-experiments-and-stacked-bar-graphs

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly