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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

How to model data for a clustered bar visual?

Hi,

I have a table from where I want to use some columns for a Clustered Bar visual.

The columns are like this:

24hs48hs72hs7 days
TrueTrueTrueTrue
FalseFalseFalseFalse
FalseFalseFalseFalse
TrueTrueTrueTrue
FalseFalseFalseFalse

 

I want to create a Clustered Bar Chart so each cluster is one of those columns (24hs would be one cluster, with True and False being each of the bars). However I can't find a way of add the data to the visual and show all the different columns. It always shows the first column.

So I'm thinking that maybe I need to remodel the data to something like this:

FrequenceTRUEFALSE
24hs23
48hs23
72hs23
7 days23

 

But neither I know if that would work nor how to create the new table.

 

Can you help me?

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Already couple of good solution around M.

Refer Dax Solution

union(
 summarize(table,"Frequence","24hs","True",coutrows(filter(Table,table[24hs]="True")),"Fales",coutrows(filter(Table,table[24hs]="False")))
,summarize(table,"Frequence","48hs","True",coutrows(filter(Table,table[48hs]="True")),"Fales",coutrows(filter(Table,table[48hs]="False")))
,summarize(table,"Frequence","72hs","True",coutrows(filter(Table,table[72hs]="True")),"Fales",coutrows(filter(Table,table[72hs]="False")))
,summarize(table,"Frequence","7 days","True",coutrows(filter(Table,table[7 days]="True")),"Fales",coutrows(filter(Table,table[7 days]="False")))
)

 

Also refer unpivot

https://radacad.com/pivot-and-unpivot-with-power-bi

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Icey
Community Support
Community Support

Hi @Anonymous ,

 

It is not necessary to transform the data into what you mentioned. There is an easy way.

 

1. In Power Query Editor, select all columns and Unpivot Columns.

tf2.jpg

tf3.PNG

 

2. In Power BI Desktop, create a Clustered Bar visual.

tf4.jpg

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Pragati11
Super User
Super User

Hi @Anonymous ,

 

Follow the following steps:

1. The raw data is as follows in Query Editor:

    clust1.png

2. Select all the columns as follows and "UNPIVOT Columns Icon":

clust2.png

Once you unpivot data, you get following:

clust3.png

3. Add 2 cutsom columns as follows:

clust4.png

 

clust5.png

 

You will get the following:

clust6.png

 

4. Select "Attribute" column (in my case) and then click "GROUP BY" at the top as shown below with the settings:

clust7.png

 

5. You will get the desired output as follows:

clust8.png

You can then try creating your clustered bar chart.

I tried something as follows:

clust9.png

 

If this helps please give Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors