cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jvirgi Helper II
Helper II

Creating a diverging stacked bar chart to show sentiment

I was trying to create a diverging stacked bar chart to show the %'s of sentiment on data.  I can't figure out an easy way to do this in power BI.  

Here is a sample set of data:

SportTEXTSentiment
HockeyText 1Positive
HockeyText 2Positive
HockeyText 3Negative
HockeyText 4Positive
HockeyText 5Negative
HockeyText 6Positive
HockeyText 7Positive
GolfText 8Positive
GolfText 9Positive

 

This is a an example of the type of chart i'd like to create from the data:

chart-example.png

 
1 ACCEPTED SOLUTION

Accepted Solutions
Super User IV
Super User IV

Re: Creating a diverging stacked bar chart to show sentiment

@jvirgi add following 3 measure, of course, these can be done in one measure but I like to break up the measure for easy debugging and maintenance.

 

Would appreciate Kudos 🙂 if my solution helped.

 

Base Count = COUNTROWS ( 'Table' )

Sentiment Count = IF ( SELECTEDVALUE( 'Table'[Sentiment] ) = "Negative", -1, 1 ) * [Base Count]

% Sentiment = DIVIDE ( [Sentiment Count], CALCULATE ( [Base Count], ALLSELECTED( 'Table'[Sentiment] ) ) )

 

To visualize do the following and on format pane, you can change the colors

 

 






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

Proud to be a Datanaut! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

16 REPLIES 16
Super User IV
Super User IV

Re: Creating a diverging stacked bar chart to show sentiment

@jvirgi is this what you are looking for?

 

image.png






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

Proud to be a Datanaut! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





jvirgi Helper II
Helper II

Re: Creating a diverging stacked bar chart to show sentiment

@parry2k
Yes! That’s exactly what I’m looking to do. How should I do it?
Super User IV
Super User IV

Re: Creating a diverging stacked bar chart to show sentiment

@jvirgi add following 3 measure, of course, these can be done in one measure but I like to break up the measure for easy debugging and maintenance.

 

Would appreciate Kudos 🙂 if my solution helped.

 

Base Count = COUNTROWS ( 'Table' )

Sentiment Count = IF ( SELECTEDVALUE( 'Table'[Sentiment] ) = "Negative", -1, 1 ) * [Base Count]

% Sentiment = DIVIDE ( [Sentiment Count], CALCULATE ( [Base Count], ALLSELECTED( 'Table'[Sentiment] ) ) )

 

To visualize do the following and on format pane, you can change the colors

 

 






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

Proud to be a Datanaut! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

jvirgi Helper II
Helper II

Re: Creating a diverging stacked bar chart to show sentiment

@parry2k How did you setup the chart on the format pane?  Looked like you were going to post a picture?  Thanks! 

Super User IV
Super User IV

Re: Creating a diverging stacked bar chart to show sentiment

@jvirgi oops, sorry about that, here it is. working on gazillion things at the same time.  Would appreciate Kudos 🙂 if my solution helped.

 

image.png






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

Proud to be a Datanaut! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





dpowellLE
Frequent Visitor

Re: Creating a diverging stacked bar chart to show sentiment

.@parry2k - Any suggestions for when there is a five-point scale vs a two-point one?

jvirgi Helper II
Helper II

Re: Creating a diverging stacked bar chart to show sentiment

@dpowellLE Do you have an example of how you'd want it to look?  I guess you'd want some of the 5 going on the negative axis and some on the positive side?

dpowellLE
Frequent Visitor

Re: Creating a diverging stacked bar chart to show sentiment

I would like it to look similar to this visualization. The challenge I am facing with the proposed solution is that the SELECTEDVALUE operator for the Sentiment count only works with binary responses. I am trying to figure out how to modify that step as I have now created a conditional column to range from -2 to 2.

jvirgi Helper II
Helper II

Re: Creating a diverging stacked bar chart to show sentiment

What if you just use an OR statement to label the 2 negative aspects with the -1; the 2 positive ones would automatically get a 1; youd have to decide how you want to handle the neutrals if you show or not.  

 

Since the legend is used to stack your data by the 5 different responses, it would show them all.  you'd have to think if you display the neutrals or not.

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors