Forum Discussion

talderton's avatar
talderton
Frequent Visitor
3 years ago

Stacked 100% bar chart

I would like to calculate the percentage of bar charts for categories.

When I use the 'show value as % of grand total' function, it calculates across all the subjects, but I just want it to show the percentage for each bar i.e. each subject. How do I do that?

Please see image:

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  talderton ,

    I created some data:

     

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    var _sum=
    SUMX(
        FILTER(ALL('Table'),'Table'[Group1]=MAX('Table'[Group1])),[Value])
    return
    DIVIDE(
        MAX('Table'[Value]) ,_sum)

    2. Result:

     

    Best Regards,

    Liu Yang

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

    • talderton's avatar
      talderton
      Frequent Visitor

      Using that DAX formula with my data it becomes:

       

      Measure = var _sum= SUMX( FILTER(ALL('NAPLAN 2023 preliminary'),'NAPLAN 2023 preliminary'[Proficiency_Level]=MAX('NAPLAN 2023 preliminary'[Proficiency_Level])),[NumStud]) return DIVIDE( MAX('NAPLAN 2023 preliminary'[NumStud]) ,_sum)
       
      And I get this result:
       

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  talderton ,

     

    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you

     

    Best Regards,

    Liu Yang

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