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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BoogieMan_01
Frequent Visitor

Issue with stacked bar chart splitting incorrectly

Hi everyone, 

 

I have created a survey and for a question, particpants has to rate their expereince among 4 options. Currently, this is my chart but this is extremely wrong as it's not possible for everything to be evenly split like this. 

BoogieMan_01_0-1745215487724.png

 

My whole page is already filtered by Undergraduate and Postgraduate, but that shouldn't be the issue. 

Currently, my DAX formulas are: 

Q12 Responses = DISTINCTCOUNT(Q12[ResponseId])
Q12 Responses Finished = CALCULATE([Q12 Responses],Q12[Finished]=true,ALLSELECTED(Q12[Q12]))
Q12 Total Responses = DIVIDE([Q12 Responses],[Q12 Responses Finished])
 
and on y-axis I have Q12 Total Responses and study type (Undergraduate and Postgraduate) on the x-axis. 
BoogieMan_01_1-1745215504596.png

 

This is a snippet of my table values and I have attached a ful spreadsheet of the data:

Survey Data.xlsx

 

Any help would be appreciated!

2 ACCEPTED SOLUTIONS
techies
Super User
Super User

Hi @BoogieMan_01 please try this

 

Q12 Finished Responses =
CALCULATE(
    [Q12 Responses],
    FILTER(Q12, Q12[Finished] = TRUE())
)
 
Q12 Response % by Option =
DIVIDE(
    [Q12 Finished Responses],
    CALCULATE(
        [Q12 Finished Responses],
        ALLSELECTED(Q12[Q12])
    )
)
― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978

View solution in original post

Hi @BoogieMan_01,

 

To properly control the order of your legend in Power BI, avoid using the raw response column (Q12[Q12]) directly. Instead, create a separate dimension table that lists all possible ratings along with a corresponding numerical index representing their intended order. This index can then be used to sort the labels correctly. By referencing this dimension table in your visual instead of the original column, Power BI will be able to respect the sort order you define.

 

create this custom Rating table using the following DAX expression:

Rating = DATATABLE(
    "Rating", STRING,
    "Index", INTEGER,
    {
        {"Yes definitely", 1},
        {"Yes probably", 2},
        {"No probably not", 3},
        {"No definitely not", 4}
    }
)

 

After creating the table, go to the Data view, select the Rating column, and apply “Sort by Column” using the Index column. This step ensures that the ratings appear in your desired custom order when used in visuals.

 

Next, set up a one-to-many relationship from Rating[Rating] to your main data table Q12[Q12]. This allows each response to map to a specific, sorted rating. Finally, use Rating[Rating] (not Q12[Q12]) in the legend field of your visual. This will enforce the proper order you've defined, giving you full control over how the survey responses are displayed.

 

 

 

 

Thanks,

Prashanth Are

MS Fabric community support

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

 

View solution in original post

14 REPLIES 14
v-prasare
Community Support
Community Support

Hi ,

As we haven't heard back from you, we are closing this thread. If you are still experiencing the same issue, we kindly request you to create a new thread we’ll be happy to assist you further.

Thank you for your patience and support.

 

If our response was helpful, please mark it as Accepted as Solution and consider giving a Kudos. Feel free to reach out if you need any further assistance.

Best Regards,

Prashanth Are

 

v-prasare
Community Support
Community Support

@BoogieMan_01, As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for your issue worked? or let us know if you need any further assistance here?

 

 

Thanks,

Prashanth Are

MS Fabric community support

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

v-prasare
Community Support
Community Support

Hi @BoogieMan_01 
Thanks for actively participating in MS Fabric community support

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for your issue worked? or let us know if you need any further assistance here?

 

 

Thanks,

Prashanth Are

MS Fabric community support

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

v-prasare
Community Support
Community Support

Hi @BoogieMan_01,

Thanks for actively participating in MS Fabric community support

 

If the solution works please do accept it as a solution so as it will be easier for others to find


Thanks In Advance

Prashanth

techies
Super User
Super User

is this what you needed ?

 

techies_0-1745241994378.png

 

― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978

Oh! @techies it worked! I have the same output as you but now the issue is that I want to arrange the legend so that it's: 

Yes definity -> yes probably -> no probably not -> no definity not

 

So I created another table called rating and made a one-to-many relationship with the main table: 

BoogieMan_01_0-1745244999679.png

Then I sorted rating by column index and put that in the legend so that it would be in the order I wanted. Is there another way to customer order my graph?

Hi @BoogieMan_01 you can sort by clicking the 3 dots 

 

techies_0-1745251832785.png

 

― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978

Hey @techies @adudani 

 

1. for the YT video, it was interesting! But ended up filling my value column with errors

2. sort legend doesn't order the values to yes definity -> yes probably -> no probably not -> no definity not, instead it sorts by descending order. So it'll be yes probably -> yes definitely-> no probably not -> no definity not. So my issue still remains

Hi @BoogieMan_01,

 

To properly control the order of your legend in Power BI, avoid using the raw response column (Q12[Q12]) directly. Instead, create a separate dimension table that lists all possible ratings along with a corresponding numerical index representing their intended order. This index can then be used to sort the labels correctly. By referencing this dimension table in your visual instead of the original column, Power BI will be able to respect the sort order you define.

 

create this custom Rating table using the following DAX expression:

Rating = DATATABLE(
    "Rating", STRING,
    "Index", INTEGER,
    {
        {"Yes definitely", 1},
        {"Yes probably", 2},
        {"No probably not", 3},
        {"No definitely not", 4}
    }
)

 

After creating the table, go to the Data view, select the Rating column, and apply “Sort by Column” using the Index column. This step ensures that the ratings appear in your desired custom order when used in visuals.

 

Next, set up a one-to-many relationship from Rating[Rating] to your main data table Q12[Q12]. This allows each response to map to a specific, sorted rating. Finally, use Rating[Rating] (not Q12[Q12]) in the legend field of your visual. This will enforce the proper order you've defined, giving you full control over how the survey responses are displayed.

 

 

 

 

Thanks,

Prashanth Are

MS Fabric community support

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

 

ok

― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978

Hi @techies 

Yes! That is what I need! Did you get that from using the your previous DAX formula?

hi @BoogieMan_01 ,

 

An alternative to sort by columns reference:Never do Sort by Column Again! MUST WATCH 🔥

The solution using DAX to add non width spaces. 

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash
techies
Super User
Super User

Hi @BoogieMan_01 please try this

 

Q12 Finished Responses =
CALCULATE(
    [Q12 Responses],
    FILTER(Q12, Q12[Finished] = TRUE())
)
 
Q12 Response % by Option =
DIVIDE(
    [Q12 Finished Responses],
    CALCULATE(
        [Q12 Finished Responses],
        ALLSELECTED(Q12[Q12])
    )
)
― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978

Hi @techies ! 

Thank you for the reply but unfortunately it did not work... It's still showing the same graph

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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 Solution Authors
Top Kudoed Authors