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

Need yes/no based off 2 different columns in Power BI

I have 3 columns:

Invoice ID

Product ID

IS AH

 

Obviously, there are multiple products on one invoice.  If there is a specific product on an invoice (product 'Z' in example below), IS AH gives me a yes for that specific line.

 

I need a column that will give me a yes for all the other lines on any invoice that has a "yes" in column "IS AH".

 

Any suggestions?

Example below

 

delete.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous,

Thank you for the sample. Here is my solution:

  1. Quantify Yes, No to 0,1
  2. Get total Value quantify by each invoice
  3. If total Value = 0, "No",  "Yes"

 

You can create 2 calculated columns as follow:

 

ISAH Value = IF(Table10[IS AH] = "No",0,1)
NEEDED Column = VAR ISAH_value_by_invoice = CALCULATE(SUM(Table10[ISAH Value]),
FILTER(Table10,Table10[Invoice ID] = EARLIER(Table10[Invoice ID]))) RETURN IF(ISAH_value_by_invoice = 0,"No","Yes")

Here is the result:

 

3.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Let me know if this helps.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@Anonymous,

 

If you can provide a sample data and the output you want, it will be clearer. Otherwise, I don't know why you want this column for if have an invoice with 1 product, I think it should not have other lines but only 1?

Anonymous
Not applicable

Updated with example.

 

Issue is that there are MANY products per invoice.

Anonymous
Not applicable

@Anonymous,

Thank you for the sample. Here is my solution:

  1. Quantify Yes, No to 0,1
  2. Get total Value quantify by each invoice
  3. If total Value = 0, "No",  "Yes"

 

You can create 2 calculated columns as follow:

 

ISAH Value = IF(Table10[IS AH] = "No",0,1)
NEEDED Column = VAR ISAH_value_by_invoice = CALCULATE(SUM(Table10[ISAH Value]),
FILTER(Table10,Table10[Invoice ID] = EARLIER(Table10[Invoice ID]))) RETURN IF(ISAH_value_by_invoice = 0,"No","Yes")

Here is the result:

 

3.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Let me know if this helps.

Anonymous
Not applicable

THANK YOU!  Genius work-around!

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.