cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
adriaXIII New Member
New Member

column chart with 5 separate pieces of data

 

Hi, 

 

 I wish to create a column chart with 5 separate pieces of data from a dataset.

 

excel table.png

 

So, I have Fields named: - Bebidas azucaradas, bebidas no azucaradas, bebidas isotónicas, bebidas energéticas. These 5 fields are the answer to a multichoice question (what kind of non-water beveradges do you drink?). 

 

I wish the column chart to show these as 5 separate columns with a gapin-between. Each column should show the recount of "Yes" and "No" answers. Whenever I try, I amb either getting them stacked on top of one another (using the stacke version), or right next to each other (using the clustered), without the headings/tiles below. 

 

picture bi forum.png

 

Many thanks, 

 

Adrià

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Re: column chart with 5 separate pieces of data

Hi, @adriaXIII 

 

one way of doing this is to unpivot your table, either in the query to the source or in Powerquery/Advanced editor(using the Unpivot Columns-function of the Transform ribbon).

 

Your table should then look like this

AttributeValue
question 1si
question 1no
question 1 no
and so on 

 

The columns can be renamed to e.g. Question and Answer.

Now create two measures:

 

positive answer = CALCULATE(COUNTROWS(answers);filter(answers;answers[Answer]="Si")) 
Negative answer = CALCULATE(COUNTROWS(answers);filter(answers;answers[Answer]="No")) 

 

and add the questions and the measures to a chart like this:
Capture.PNG

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

View solution in original post

1 REPLY 1
Super User III
Super User III

Re: column chart with 5 separate pieces of data

Hi, @adriaXIII 

 

one way of doing this is to unpivot your table, either in the query to the source or in Powerquery/Advanced editor(using the Unpivot Columns-function of the Transform ribbon).

 

Your table should then look like this

AttributeValue
question 1si
question 1no
question 1 no
and so on 

 

The columns can be renamed to e.g. Question and Answer.

Now create two measures:

 

positive answer = CALCULATE(COUNTROWS(answers);filter(answers;answers[Answer]="Si")) 
Negative answer = CALCULATE(COUNTROWS(answers);filter(answers;answers[Answer]="No")) 

 

and add the questions and the measures to a chart like this:
Capture.PNG

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

View solution in original post

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors