Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
pamebenal
Frequent Visitor

Percentage of column total in a stacked column chart

Hello, I have an issue with getting the percentages of some values not of the grand total but of column total given some data. In the axis I'm using "months", the legend is "type of sale" and I have two categories in that column (retail and fleets). In value I was using the sum of cuantity "QTY" , but of course I cannot get the % of the column total in the chart. I've been trying to create a measure to help me, I tried        %column total= DIVIDE (
COUNT(Sheet3[TIPO DE VENTAS]),
SUM(Sheet3[QTY]))        but its not working. I would appreciate any help.

 

 

Capture.PNG

 

It should give me the values that are on the table on the left side. Thank you

 

 

Pamela

8 REPLIES 8
Anonymous
Not applicable

Hi all, 

 

I found this forum question from a few years ago that worked for me. I've used it on a 100% Stacked Bar Chart but I'm assuming the same prinicple applies here. 

 

A link to the post: https://community.powerbi.com/t5/Desktop/Grouped-percentage-of-row-total/td-p/32154

 

The DAX formula for a measure used is:

 

DIVIDE(COUNT('Table1'[Text Value]), CALCULATE(COUNT('Table1'[Text Value]), ALLEXCEPT('Table1'[Y Axis])),0)

 

Where 'Text Value' is the text column you want to count and divde (% Column Total) and 'Y Axis' is the column you wish to put into your Y Axis of your chart. 

 

I now need to alter this formula so that my calculation ignores some value types depending on the team (e.g. some teams are required to do X but others aren't so I need to filter those out). Any ideas?

 

E

emilypoon
Advocate I
Advocate I

Hi,

 

I am facing the same issue and my column chart cannot display the total of 100% as per our need.

 

I want to have a stack column chart as shown below, with X axis as the "Count of number of PO" and Y axis as period by month.

The total of each stacked column should add up to 100%, and the column height represents the total number of POs.

 

1.PNG

 

 

I put a DAX formula as a measure of calculation for the percentage of KPI.

 

2.PNG

 

 

Finally, I got a chart like the one shown below but the percentage calculation is for all the data (ie. total of all the columns will be 100%, but not 100% for each individual bar.

 

3.PNG

 

 

Is there any solution to solve the above problem?

 

Best regards,

Emily

 

Anonymous
Not applicable

Hello,

 

Could you please tell me if you have found the sollution for the "The total of each stacked column should add up to 100%, and the column height represents the total number of POs"?


Kind regards,

Robert

 

Anonymous
Not applicable

Hi @emilypoon ,

Did you find a solution for this, I was able to get the total of the each stacked column adding to 100% but the column height is not varing, it represents a 100% stacked column.

 

Please take a look on the DAX used and the output of the visualization and do suggest!!Single Part Selected.PNGMultiple Part Selected.PNGDAX.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thankyou in advance,

Regards,

Harish

v-qiuyu-msft
Community Support
Community Support

Hi @pamebenal,

 

From your description, you would like to calculate the percentage of each stack value divided by total value of each MES6, right? 

 

You can create a measure below: 

 

Measure = DIVIDE(SUM(Table1[QTY]),CALCULATE(SUM(Table1[QTY]),ALLEXCEPT(Table1,'Table1'[MES6])))

 

q3.PNG

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-qiuyu-msft, thank you very much for your answer. But I am still not getting the right results. With the formula stated I got this:

Capture.PNG

 

The resultas that I should get are the ones you got, but I really dont know what am I making wrong. If there is anything that occurs to you I would really appreciate it. 

 

Thank again,

 

Pamela

Tableau has had this functionality for several years. Drag and drop solution. You may want to try it out.

Hi @pamebenal,

 

Would you please share pbix file with us? Please remove sensitive data before sharing it. 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.