Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Help Calculating Percentage Correctly

Hello,

 

I currently have a cluster column (?) chart that is exactly what I want *except* that it currently displays by count and I need it to display in percentages. I'm just not sure how to do the formula correctly.

 

I have things divided up by "broad group" and also "date ranges" ('09-'14; '15-'20, '21-'22)

 

 

My goal is to have the graph show, for example:

the Percent of the total '09-'14 samples that are in Broad group AL2

the Percent of the total '15-'20 samples that are in Broad group AL2

the Percent of the total '21-'22 samples that are in Broad group AL2

and do this for each of the broad groups. 

So the Orange bars should add up to 100%, the blue bars should add up to 100%, and the maroon bars should add up to 100%

 

When my formulas are "Percent Count 2009-2014=Divide('Table'[Count 2009-2014],'Table'[Count Rows])" Then it appears that all my percentages add up to over 100% so I'm obviously doing something wrong.

 

 

Any help is greatly appreciated!
  • Step 1. Create a Group for years and named them.

    Step 2.  Define what is the unique count. In my case i used COUNTROWS, but you need to check if its correct definition.

     

    Count of samples = COUNTROWS('Sample')

     

    Step 3. Define share measure.

     

    Share of samples =
    var _thisSamples = [Count of samples]
    var _allSamples = CALCULATE([Count of samples],ALL('Sample'[Broad Group]))
    return DIVIDE(_thisSamples,_allSamples)

     

    Check it and let me know if this is what you wanted. 🙂

6 Replies

  • bolfri's avatar
    bolfri
    Icon for Solution Sage rankSolution Sage

    Is it possible for you to share some sample data to work with? I can help you with that. 🙂

    • Anonymous's avatar
      Anonymous
      Not applicable

      I threw together a sample excel file, but I can't find where I can upload the file. There used to be a button because I've done it before, but now I'm not seeing it?