Forum Discussion

sd_09's avatar
sd_09
Frequent Visitor
2 years ago
Solved

Clustered Bar chart

Hi all, 

 

I am trying to make a clustered bar chart in PowerBI, similar to one that I made in excel, but cant. I have sample data below. 

 

In the chart, I would like to provide the averages of each of these questions split by survey type. In excel, for example, it would be, make a pivot table, the questions in "values" area (summarize values by averages), the actual values in rows and the survey type in columns. 

 

I have tried multiple ways in PowerBI, the closest I have reached is to having the questions as a legend and survey type as rows. Does anyone know how I can interchange this so survey type becomes the legend and the questions become rows? 

 

Sample Data

CandidatesDateQ1 scoreQ2 score Q3 scoreCountryDepartmentSurvey type
130/5/2024542FranceFinanceHired
220/5/2024379BelgiumSalesRejected
311/5/2024835GermanySalesRejected
428/4/2024562FranceHRHired
515/4/2024824BelgiumFinanceRejected
615/2/2024287GermanyFinanceRejected
706/01/2024769FranceHRRejected
831/5/2024933BelgiumSalesHired
931/5/2024494GermanySalesHired

 

Thank you!!

  • Anonymous's avatar
    Anonymous
    2 years ago

    sd_09  thanks

     

    He're is a short video that demonstrates how to do the visual you want with the sample of data you provided, tell me if its good for you

     

9 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi sd_09 

     

    I don't know if I figured out your need but here is a solution:

    With the data you provided:

    • I went to PowerQuery
    • I selected the Q1 score, Q2 score and Q3 score columns
    • Right click > "Unpivot only selected columns" 
    • I got "Attribute" and "Value" columns

    Now within PowerBI

    • Stacked column chart

     

    OR to be more precise "provide the averages of each of these questions split by survey type"

     


    Does it answer your question?

     

    • sd_09's avatar
      sd_09
      Frequent Visitor

      Hey Anonymous 

       

      Thanks for your response! Unfortunately, when I try to unpivot these columns, it gives me all the columns with error in the data set. Not sure why this is the case? Could it be because of blanks? 

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hey sd_09 

         

        Its strange because it works with the data sample you provided

        I tried by insterting null values in Q-Score columns and the pivot works

        Actually if the Q-Score values are null, it seems that the values are not pivoted (and rejected)

         

        If it's not that confidential, don't hesitate to send me a more realistic sample of your data (with all columns) so I can try it better in my side.

         

        Have a nice day