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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Measure causing column to split in two within matrix

I am creating a measure to leverage for conditional formatting. However I'm running into something strange. I Created an IF statement to check two conditions. If both conditions are true, it should return a 1, otherwise a 0. 

 

JobDistrict is one of the conditional fields, and is the top level of a hierarchy, with JobName as the second level. In my matrix, it must be drilled down to the JobName level. However, when I do that, I noticed something strange. The "Salad" JobName splits out to two columns. This is a problem because it is returning a 0 & blank, but this value should actually be a 1 because the conditions for JobDistrict and Est. Margin are met. I have confirmed that this is the only "Salad" JobName, but I'm not sure what else could possibly be causing this, as the others seem to be fine.

 

Does anyone know what's going on with this? Do i need to alter the measure?

 

Here's my measure

 

 

Format Margin = if(SELECTEDVALUE('dim Job'[JobDistrict])="South" && [Est. Margin]>=.122
                ||SELECTEDVALUE('dim Job'[JobDistrict])="West" && [Est. Margin]>=.310
                ||SELECTEDVALUE('dim Job'[JobDistrict])="Northeast" && [Est. Margin]>=.188
                ,1,0)

 

 

margin issue.png

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Anonymous - It's difficult to say but I am concerned about your formula and whether it is implementing your logic correctly.

Format Margin = if( (SELECTEDVALUE('dim Job'[JobDistrict])="South" && [Est. Margin]>=.122)
                || (SELECTEDVALUE('dim Job'[JobDistrict])="West" && [Est. Margin]>=.310)
                || (SELECTEDVALUE('dim Job'[JobDistrict])="Northeast" && [Est. Margin]>=.188)
                ,1,0)

Try that and see if things clear up. 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

Due to I don't know your data model , so I build a sample table to have a test.

1.png

Build a measure 

 

Est.Margin = SUM('dim Job'[Qty])/100

 

Then use your Format Margin Measure and build a Matrix.

2.png

However whether I delete the row with red box or change 0 to blank, my result in Matrix shows correctly as above.

I think your problem may be caused by your data model or your other measures in Matrix.

Could you show me your data model and provide me more details about your Est.Margin Measure?

Or you can share your pbix file with me by your Onedrive for Business.

 

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. 

 

Greg_Deckler
Super User
Super User

@Anonymous - It's difficult to say but I am concerned about your formula and whether it is implementing your logic correctly.

Format Margin = if( (SELECTEDVALUE('dim Job'[JobDistrict])="South" && [Est. Margin]>=.122)
                || (SELECTEDVALUE('dim Job'[JobDistrict])="West" && [Est. Margin]>=.310)
                || (SELECTEDVALUE('dim Job'[JobDistrict])="Northeast" && [Est. Margin]>=.188)
                ,1,0)

Try that and see if things clear up. 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler  Good catch, but that didn't resolve the issue. No idea what it could be doing. I've tried to come up with another way to leverage measures and columns but no luck.

@Anonymous - OK, but you don't actually need that measure in your visual, right? You just want to use it for conditional formatting?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler Correct

@Anonymous - So what happens if you take it out of the visual and use it in your conditional formatting for your other measure/column, does it return the right value (color)?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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