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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anshenterprices
Helper IV
Helper IV

Sorting of horizontal bar visual

Hi Team,

Source table 

Table A

 

Script IDCategoryRelienceTataGodrejTCSColgate
1Equity100150120140160
2Comm210120235147135

 

Table B
Script IDCategoryMF
1Equity170
2Comm180



Reqirment : i want to create a bar graph when user select category from the slicer and bar graph it should present 

RelienceTataGodrejTCSColgate
MF

and sort by the low to high value 

Anshenterprices_0-1650346260482.png


Note:- we dont want to pivot/unpivot the source data

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anshenterprices ,

 

I suggest you to create a Dimtable with column headers as "Relience","Tata","Godrej","TCS","Colgate" you need.

Axis = 
{"Colgate","TCS","Godrej","Tata","Relience"}

Then create a measure to calcualte the sum of value.

Measure = 
SWITCH(
MAX('Axis'[Axis]),
"Colgate",CALCULATE(SUM('Table A'[Colgate])),
"TCS",CALCULATE(SUM('Table A'[TCS])),
"Godrej",CALCULATE(SUM('Table A'[Godrej])),
"Tata",CALCULATE(SUM('Table A'[Tata])),
"Relience",CALCULATE(SUM('Table A'[Relience]))
)

Create a bar chart by Axis[Axis] in Axis and [Measure] in Value, then you can sort your visual by measure.

RicoZhou_0-1650609442634.png

 

Best Regards,
Rico Zhou

 

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

View solution in original post

4 REPLIES 4
Anshenterprices
Helper IV
Helper IV

@amitchandak  Can you please explain how to do that? Based on the values it will sort?

thank you

amitchandak
Super User
Super User

@Anshenterprices , Create 5 measures and put them in visual in the order you want

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

@amitchandak  but those are already a seperate columns and its a meausure ? Can you please explain how to do that? Based on the values it will sort?

thank you

Anonymous
Not applicable

Hi @Anshenterprices ,

 

I suggest you to create a Dimtable with column headers as "Relience","Tata","Godrej","TCS","Colgate" you need.

Axis = 
{"Colgate","TCS","Godrej","Tata","Relience"}

Then create a measure to calcualte the sum of value.

Measure = 
SWITCH(
MAX('Axis'[Axis]),
"Colgate",CALCULATE(SUM('Table A'[Colgate])),
"TCS",CALCULATE(SUM('Table A'[TCS])),
"Godrej",CALCULATE(SUM('Table A'[Godrej])),
"Tata",CALCULATE(SUM('Table A'[Tata])),
"Relience",CALCULATE(SUM('Table A'[Relience]))
)

Create a bar chart by Axis[Axis] in Axis and [Measure] in Value, then you can sort your visual by measure.

RicoZhou_0-1650609442634.png

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors