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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
rafalvarezt
New Member

If statement with multiple slicers

Hi, I'm new to PBI and need some help creating a measure and will only display data selected by filters

 

I have a filter for [Year]

2020

2019

2018

 

i have a filter for [Company]

A

B

C

 

the display table has [Employees] and number of [Orders] 

 

I would like to create a [Result]Measure that looks at [Orders] and If more than 5 orders completed then writes Good, otherwise write Bad

 

and only display that measure for [Employees] that were selected from the filter

i.e if i select the filter 2020 and B, i would like somethin like this to display

YearCompanyEmployeeOrdersResult
2020BJoe2Bad
2020BJane6Good
2020BJohn4Bad
2020BSmith1Bad

 

Thank you

1 ACCEPTED SOLUTION

@rafalvarezt 

Go to the relationship panel, check whether is a relationship. Usually relationship will be automatically created for very relevant tables, if not you need to add it manually. 

relationship.JPG

 

Once you have created the measure, simply filter Year to 2020, Company to B will get your expected output. 


Paul Zheng _ Community Support Team
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

4 REPLIES 4
Greg_Deckler
Super User
Super User

@rafalvarezt - Try something like:

Measure = IF(SUM('Table'[Orders])>5,"Good","Bad")

Shouldn't your slicers already be filtering your table or are they disconnected tables? 



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

when i enter the measure suggested, it does display the new [Result] column but also displays all employees for all years 

 

Does that mean the tables are disconnected? if so, is there a way to fix?

Thanks again

@rafalvarezt 

Go to the relationship panel, check whether is a relationship. Usually relationship will be automatically created for very relevant tables, if not you need to add it manually. 

relationship.JPG

 

Once you have created the measure, simply filter Year to 2020, Company to B will get your expected output. 


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

amitchandak
Super User
Super User

@rafalvarezt , Try

measure = if(sum(table[Orders]) >5,"Good", "Bad")

 

column = if((table[Orders]) >5,"Good", "Bad")

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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