cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
lit2018pbi Frequent Visitor
Frequent Visitor

Display percentage in stacked column chart

Hi,

 

I wanted to display percent of the overall set for the year as a tooltip in Power BI for a stacked column chart. Is there anyway to do it? 

 

Dataset: 

LabelValueYear

A402015
B302015
C102015
D502015
A302016
B202016
C602016
D302016

1.PNG

 

 

 

In the example above, I want add a tooltip for each Label - A,B,C,D individually to display the % for the specific year. Eg: For 2016, label A should display 30/140*100 = 21.42% as a tooltip and similarly rest of the labels too.

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
dedelman_clng New Contributor
New Contributor

Re: Display percentage in stacked column chart

 Make this measure:

 

 

PctGT =
DIVIDE (
    SUM ( 'Table'[Value] ),
    CALCULATE ( SUM ( 'Table'[Value] ), ALL ( 'Table'[Label] ) ),
    0
)

 

Capture.PNG

 

Hope this helps,

David

View solution in original post

Super User
Super User

Re: Display percentage in stacked column chart

Hi @lit2018pbi,

 

Add this measure to your tooltip and format as %, should work.

 

percentage =
DIVIDE (
    SUM ( Table1[Value] );
    (
        CALCULATE (
            SUM ( Table1[Value] );
            ALL (  Table1[Label] );
            FILTER ( ALL ( Table1[Year] ); Table1[Year] = MAX ( Table1[Year] ) )
        )
    )
)

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




View solution in original post

dedelman_clng New Contributor
New Contributor

Re: Display percentage in stacked column chart

Same basic code, but make a measure first like:

 

MyCount = CALCULATE( COUNTA ('Table3'[ID] ) )

Then everywhere you have " SUM ('Table1'[Value] ) " replace it with the measure above.

 

PctGTCnt =
DIVIDE ( [MyCount], 
         CALCULATE ( [MyCount], ALL ( 'Table3'[Value] ) ),
         0 )

Capture.PNG

View solution in original post

4 REPLIES 4
dedelman_clng New Contributor
New Contributor

Re: Display percentage in stacked column chart

 Make this measure:

 

 

PctGT =
DIVIDE (
    SUM ( 'Table'[Value] ),
    CALCULATE ( SUM ( 'Table'[Value] ), ALL ( 'Table'[Label] ) ),
    0
)

 

Capture.PNG

 

Hope this helps,

David

View solution in original post

Super User
Super User

Re: Display percentage in stacked column chart

Hi @lit2018pbi,

 

Add this measure to your tooltip and format as %, should work.

 

percentage =
DIVIDE (
    SUM ( Table1[Value] );
    (
        CALCULATE (
            SUM ( Table1[Value] );
            ALL (  Table1[Label] );
            FILTER ( ALL ( Table1[Year] ); Table1[Year] = MAX ( Table1[Year] ) )
        )
    )
)

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




View solution in original post

lit2018pbi Frequent Visitor
Frequent Visitor

Re: Display percentage in stacked column chart

we have one more scenario like this which has date column (that we need to use on X-axis) is in another table and we dont have a numeric value in values. instead of that it showing categories, I have attached a picture for your reference. I wanted to display percent of that particular category individually  and considering that bucket itself as 100% as a tooltip in Power BI for a stacked column chart.

 

REF TABLE :

IDVALUEREF_DATE

AP1 TIMELY11/1/2016
BP1 UNTIMELY11/1/2016
CP2 TIMELY11/1/2016
DP1 TIMELY12/1/2016
EP1 UNTIMELY1/1/2017
FP2 TIMELY12/1/2016
GP1 TIMELY11/1/2016
HP2 UNTIMELY11/1/2016

 

DATE:

YEARMonthShort

2016Tuesday, November 01, 2016
2016Saturday, October 01, 2016
2016Thursday, September 01, 2016
2016Thursday, December 01, 2016
2017Sunday, January 01, 2017

 

viz:

 

2.PNG

dedelman_clng New Contributor
New Contributor

Re: Display percentage in stacked column chart

Same basic code, but make a measure first like:

 

MyCount = CALCULATE( COUNTA ('Table3'[ID] ) )

Then everywhere you have " SUM ('Table1'[Value] ) " replace it with the measure above.

 

PctGTCnt =
DIVIDE ( [MyCount], 
         CALCULATE ( [MyCount], ALL ( 'Table3'[Value] ) ),
         0 )

Capture.PNG

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 37 members 872 guests
Please welcome our newest community members: