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

Values exist in two columns to create/filter to a new column

I am trying create a new column that comfirms if a customer has bought product from both distributors. An example data set is below. Most companies only by one from distributor, however there are some that buy from both. I want to be able to filter out the custoemrs that buy from both distributors.

 

The columns I'm using below are 'Customer'[Customer Name], 'Distributor'[Distributor Name] and 'Key Measures'[Revenue].

These columns also exist in my fact table (called 'Orders'). eg.  'Orders'[Customer Name], 'Orders'[Distributor Name] etc.

 

Distributors.PNG

 

I understand that this will most likely involve nested IF AND statements, but I am unable to get it to work!

 

Does anyone have tips to point me in the right direction?

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @LewisB ,

Sorry for replying late. You can create a measure liek this, put it in the visual filter and set its value as 0:

visual control =
IF (
    COUNTX (
        FILTER ( 'Key Measures', 'Key Measures'[Revenue] <> BLANK () ),
        [Customer]
    ) >= 2,
    1,
    0
)

matrix.png 

Attached a sample file in the below, hopes it could help.

 

Best Regards,
Community Support Team _ Yingjie Li
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

3 REPLIES 3
v-yingjl
Community Support
Community Support

Hi @LewisB ,

Sorry for replying late. You can create a measure liek this, put it in the visual filter and set its value as 0:

visual control =
IF (
    COUNTX (
        FILTER ( 'Key Measures', 'Key Measures'[Revenue] <> BLANK () ),
        [Customer]
    ) >= 2,
    1,
    0
)

matrix.png 

Attached a sample file in the below, hopes it could help.

 

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

LewisB
Frequent Visitor

Would nested IF statements be better in this regard?

LewisB
Frequent Visitor

I have tried the below formula, however it just shows up as "No" for all rows:

 

Both Distributors = SWITCH(
TRUE(),
Orders[Distributor Name] = "Distributor 1" && Orders[Distributor Name] = "Distributor 2" && [Revenue] > 0, "Yes",
"No"
)
 
I'm sure I'm missing a simple step here. Does it have something to do with the fact that both distributors are drawn from the same column in the same table?

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.