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
dli9
Frequent Visitor

How do you add OR function to a IF/MAX measure?

My chart displays several colors and I'd like to list them in the measure, but I keep receiving an error message that says the syntax is not correct. I do not want to create one measure per color either. 

 

Scaled Volume MeasureIFMAX = IF(MAX((ColorsTable[ColorsTable])="Red", (Colorstable[ColorsTable])="Yellow"), [Raw Volume Total] * [Power BI Scale],[Raw Volume Total]))
 
Colors should include, Red, Yellow, Blue, and Orange
1 ACCEPTED SOLUTION

Hi @dli9 ,

 

Create a new table contains color column and has no relationship with the original table.

Slicer table = distinct(colortable[color])

Then use this table as color slicer and modify the measure as below.

Scaled Volume Measure = 
IF(
    MAX( ColorsTable[ColorsTable]) IN VALUES('Slicer table'[color]), 
    [Raw Volume Total] * [Power BI Scale],
    [Raw Volume Total]
)

3.PNG

 

Best Regards,

Jay

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Does this measure work?

=if(MAX(ColorsTable[ColorsTable])="Red"||MAX(ColorsTable[ColorsTable])="Yellow"||MAX(ColorsTable[ColorsTable])="Blue"||MAX(ColorsTable[ColorsTable])="Orange",[Raw Volume Total] * [Power BI Scale],[Raw Volume Total])


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Fowmy
Super User
Super User

@dli9 

Could be this : 


Scaled Volume Measure = 
IF(
    MAX( ColorsTable[ColorsTable]) IN {"Red","Yellow", "Blue","Orange"}, 
    [Raw Volume Total] * [Power BI Scale],
    [Raw Volume Total]
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

dli9
Frequent Visitor

@Fowmy 

 

That worked! However, I'm running into the issue of all my colors being scaled now when I filter by All Colors. For example, if I filter color by Green and Scale by 1.5, I want to see the bar chart for green move whilst the rest remain the same. I also don't want a bar graph that only shows Green. 

 

dli9_0-1629492401185.png

 

 

Hi @dli9 ,

 

Create a new table contains color column and has no relationship with the original table.

Slicer table = distinct(colortable[color])

Then use this table as color slicer and modify the measure as below.

Scaled Volume Measure = 
IF(
    MAX( ColorsTable[ColorsTable]) IN VALUES('Slicer table'[color]), 
    [Raw Volume Total] * [Power BI Scale],
    [Raw Volume Total]
)

3.PNG

 

Best Regards,

Jay

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

@v-jayw-msft 

 

Great, this works. If I filtered by one color and only want to see that color, would I just replace Slicertable [color] with Colorstable[color]. Using the example earlier, if I filter color by Green and Scale by 1.5, I want to ONLY want to see green with the scaled number. 

 

Scaled Volume Measure = 
IF(
    MAX( ColorsTable[ColorsTable]) IN VALUES('ColorsTable[ColorsTable]), 
    [Raw Volume Total] * [Power BI Scale],
    [Raw Volume Total]
)

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.