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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
MrCasquatch
New Member

DAX for ratio isn't following slicer selection

Hello! Long time reader, first time poster. I'm fairly new to Power BI and DAX, I've just been struggling along reading and reproducing things from the forums, but I've run into an issue that I can't seem to find a solution for.

 

I've got a gauge visualization that is based on a Measure/DAX formula, but the gauge isn't adjusting based on the slicer selection. The main problem with this is that the DAX/gauge are being selective with part of the formula, but not another. I'm curious how I can get it to follow the slicer selection for everything.

 

Through my struggles I've split things up into many different measures to try and get things figured out. Here's what I have setup and the end results as well as what I'm hoping to achieve.

 

PowerBI_Vis.PNG

 

And here's the measure foruma's that I've got setup. I have a feeling not all of them are necessary, but this is where I'm at currently. (I had it much more simplified before with the same end result).

All Clashes = SUM(ProjectClashes[Total Clashes])

All Elements = SUM(ProjectElements[Count])

Selected Elements =
CALCULATE(
'ProjectElements'[All Elements],
ALLSELECTED('ProjectElements'[Filename])
)

Selected Clashes =
CALCULATE(
'ProjectElements'[All Clashes],
ALLSELECTED('ProjectElements'[Filename])
)

Project Grade = 1-
DIVIDE ('ProjectElements'[Selected Clashes], 'ProjectElements'[Selected Elements])

 

So looking at the tables on the right of the image above, there is a "correct" table and one that isn't showing as it should be. This is my delimma. The "correct" table is showing the proper clashes and elements for the selected projects in the slicer, and it's grade is also showing the correct value based on the slicer (268+402=670 / 38174 = 0.0175, 1-0.0175 = 98.24).

 

The ONLY difference between the two tables is that on the "Correct" table, the ProjectClashes[Total Clashes] value is set to "Not Summarize" for the data, while it is set to "Sum" on the lower table.

 

Basically I need to be able to force the Project Grade formula to not sumarize ALL of the clashes, but instead just the selected ones.

 

What am I doing wrong?

 

Thanks!

2 REPLIES 2
MrCasquatch
New Member

@amitchandak, just tested and it behaves the same when ALLSELECTED is removed.

amitchandak
Super User
Super User

@MrCasquatch , Try without allselected

All Clashes = SUM(ProjectClashes[Total Clashes])

All Elements = SUM(ProjectElements[Count])

Selected Elements = 
CALCULATE(
[All Elements]
)

Selected Clashes =
CALCULATE(
'ProjectElements'[All Clashes]
)

Project Grade = 1-
DIVIDE ('ProjectElements'[Selected Clashes], 'ProjectElements'[Selected Elements])
Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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