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! Learn more

Reply
rumittal
Microsoft Employee
Microsoft Employee

DAX query to calculate % of total without bar graph axis slicing the measure values

Hi All,

 

I have below kind of data(table at bottom) , where I need to calculate % of unique tests for each Priority category (Px). and plot it on bar graph (sample at bottom),

I have below DAX queries:

PriorityGroup(Axis) = SWITCH(TRUE(),TESTS[Value]<.9, "Group < 0.9",TESTS[Value]<0.98,"Group > 0.90 and < 0.98","Group >= 0.98")

PriValues(Value) = DIVIDE (
CALCULATE( DISTINCTCOUNT( TESTS[IDTest]) ),
CALCULATE ( DISTINCTCOUNT( TESTS[IDTest]), ALL ( TESTS[IDTest]))
)

But it doesn't seem to work, as denominator in 'PriValues(Value) ' is also sliced by the PriorityGroup on X-axis. so it gives only Tests for that specific priority like P1, but not all in the table.

 

Can you help if there is the correct way or how to achieve this ? 

 

TestValuePrioritygroup
C10.98P1
C10.98P1
C10.98P1
C20.97P1
C20.97P1
C20.97P1
C30.95P2
C30.95P2
C30.95P2
C40.94P2
C40.94P2
C40.94P2

 

Intention.PNG

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @rumittal ,

Is this what you want?

%.PNG

If so, you can create your measure like so:

PriValues(Value) Measure =
DIVIDE (
    CALCULATE ( DISTINCTCOUNT ( TESTS[Test] ) ),
    CALCULATE ( DISTINCTCOUNT ( TESTS[Test] ), ALL ( TESTS ) )
)

 

Best Regards,
Icey

 

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

2 REPLIES 2
Icey
Community Support
Community Support

Hi @rumittal ,

Is this what you want?

%.PNG

If so, you can create your measure like so:

PriValues(Value) Measure =
DIVIDE (
    CALCULATE ( DISTINCTCOUNT ( TESTS[Test] ) ),
    CALCULATE ( DISTINCTCOUNT ( TESTS[Test] ), ALL ( TESTS ) )
)

 

Best Regards,
Icey

 

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

 

rumittal
Microsoft Employee
Microsoft Employee

@Icey, Thanks for the awesome suggestion,it worked wonders for me! 🙂 

 

For anyone who comes here, I was making a mistake on where to set ALL on, ideally it should be set on column from where you want to remove filter or entire table if thats where you want to remvoe any and all fitlers.

PriValues(Value) Measure =
DIVIDE (
    CALCULATE ( DISTINCTCOUNT ( TESTS[Test] ) ),
    CALCULATE ( DISTINCTCOUNT ( TESTS[Test] ), ALL ( TESTS ) )
)

Helpful resources

Announcements
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!

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