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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
haniizz_derar20
New Member

Need you help with this chart

Hi All

 

how can I vesualize this data in power bi to have the same visual in the picture

 

indexintention to returnpossibility to return
1YesNo
2YesYes
3NoNo
4NoNo
5YesYes
6NoYes
7NoYes
8NoNo
9NoNo
10YesNo

 

haniizz_derar20_0-1672296417589.png

 

3 ACCEPTED SOLUTIONS
ddpl
Solution Sage
Solution Sage

@haniizz_derar20 try below

 

First you need to unpivot the last column as per below from power query.

 

ddpl_1-1672298788823.png-

ddpl_2-1672298837102.png

 there is two way

1. cluster bar chart create measure as per below

Measure = 
VAR _A=
    COUNT('Table'[index])
VAR _B =
    CALCULATE ( COUNT('Table'[index]), ALLSELECTED('Table'[Value]) )

RETURN
    DIVIDE ( _A, _B )

then plot into chart

2.create stacked bar chart without create any measure direcltly plot in to chart as per below

 

ddpl_0-1672298632863.png

View solution in original post

themistoklis
Community Champion
Community Champion

@haniizz_derar20 

 

You should unpivot the table first using Power Query.

 

Select the fields intention to return and possibility to return, right click on them and unpivot columns.

 

Then create a % share measure using the following formula:

% Share = 
VAR Volume =
    COUNT(Sheet1[index])
VAR AllVolume =
    CALCULATE ( COUNT(Sheet1[index]),ALLSELECTED(Sheet1) )

RETURN
    DIVIDE ( Volume, AllVolume )

 

Finally create the graph.

 

PowerBI workspace attached

 

View solution in original post

thank you ddpl for your reply

can I know the measure that you used in the previous example ? 

and how can I get the same chart as in my question ?

 

thanks again  

View solution in original post

6 REPLIES 6
ddpl
Solution Sage
Solution Sage

haniizz_derar20
New Member

thank you all for your support , it was really helpfull 

 

kind regards

TomasAndersson
Solution Sage
Solution Sage

Hi!

If you want to have a single visual that looks like that you'd have to restructure your data a bit:

In the model view, right click your data table, select Edit query and under "Transform" click "Unpivot columns" while having your two columns with questions selected: 

TomasAndersson_0-1672298826158.png

This will restructure the table (I have also changed the name of the columns here):

TomasAndersson_1-1672298857574.png
Now, you can create a measure that calculates the percentage Yes's and No's in a question.

Percentage = 
DIVIDE(
    sum('Table'[index]) ,     //Number of answers of current type (Yes/No) in current question
    CALCULATE(
        sum('Table'[index]),
        ALLSELECTED('Table'[Answer])   //All answers in current question
        )
    )

Then you can create a visual that looks like what you're looking for:

TomasAndersson_2-1672299008331.png

 

There are other ways where you don't have to transform your data, but you need more/more complicated measures. So if you can restructure the data, it would be the easiest. You could even adjust the source data so it looks "right" from the start, so you don't need to do it in Power Query.

 

Hope this helps!

 

themistoklis
Community Champion
Community Champion

@haniizz_derar20 

 

You should unpivot the table first using Power Query.

 

Select the fields intention to return and possibility to return, right click on them and unpivot columns.

 

Then create a % share measure using the following formula:

% Share = 
VAR Volume =
    COUNT(Sheet1[index])
VAR AllVolume =
    CALCULATE ( COUNT(Sheet1[index]),ALLSELECTED(Sheet1) )

RETURN
    DIVIDE ( Volume, AllVolume )

 

Finally create the graph.

 

PowerBI workspace attached

 

ddpl
Solution Sage
Solution Sage

@haniizz_derar20 try below

 

First you need to unpivot the last column as per below from power query.

 

ddpl_1-1672298788823.png-

ddpl_2-1672298837102.png

 there is two way

1. cluster bar chart create measure as per below

Measure = 
VAR _A=
    COUNT('Table'[index])
VAR _B =
    CALCULATE ( COUNT('Table'[index]), ALLSELECTED('Table'[Value]) )

RETURN
    DIVIDE ( _A, _B )

then plot into chart

2.create stacked bar chart without create any measure direcltly plot in to chart as per below

 

ddpl_0-1672298632863.png

thank you ddpl for your reply

can I know the measure that you used in the previous example ? 

and how can I get the same chart as in my question ?

 

thanks again  

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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