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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
afaherty
Helper V
Helper V

COALESCE not working in stacked bar chart, need another solution

Hello all!

I have survey data where there are 9 questions, and the answers are on a scale of 0-4:

4 = Consistently

3 = Inconsistently

2 = Minimally

1 = Not at all

0 = N/A

 

That's not important though.  I was using COALESCE to find the percentage of students (by grade) who answered with each response, with question # on the slicer.

 

So, slicer:

afaherty_0-1640115644459.png

 

Percentages in a matrix:

 

afaherty_1-1640115668308.png

I had used this measure to obtain the percentages:

Response % = COALESCE(DISTINCTCOUNT('Sheet2'[Index]),0)

 

But I want my stacked bar chart to match the matrix, and it does not.  So therefore I think I need a different DAX measure.

 

afaherty_2-1640115729295.png

 

 

I am not yet able to attach files here, as I don't have access to that feature yet. 

Here is the PowerBI file: 

Stacked Bar Chart HELP! 

 

Thanks in advance to anyone who can help!

 

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

It looks like the bar chart doesn't have an axis total quick calculation option, so you'll need to write your own explicit measure.

 

This should work for both the matrix and the bar chart without applying any 'Show value as' adjustments.

Response % =
DIVIDE (
    DISTINCTCOUNT ( 'Sheet2'[Index] ),
    CALCULATE (
        DISTINCTCOUNT ( Sheet2[Index] ),
        ALLSELECTED ( Sheet2[Survey Likert Response] )
    )
)

AlexisOlson_0-1640125903400.png

 

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

It looks like the bar chart doesn't have an axis total quick calculation option, so you'll need to write your own explicit measure.

 

This should work for both the matrix and the bar chart without applying any 'Show value as' adjustments.

Response % =
DIVIDE (
    DISTINCTCOUNT ( 'Sheet2'[Index] ),
    CALCULATE (
        DISTINCTCOUNT ( Sheet2[Index] ),
        ALLSELECTED ( Sheet2[Survey Likert Response] )
    )
)

AlexisOlson_0-1640125903400.png

 

@AlexisOlson Thank you! Perfect!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.