cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
eburg
Frequent Visitor

How to return value in a column based on two criteria?

Hello, 

 

I have what I think is a fairly straightforward question that I can't quite execute. I have criteria, in this case ingredient, that are shared across multiple items. I want to look up and return a value based on multiple criteria into another dataset.

 

So I have a dataset that has days worth of results with both Column A and Column C below. So the Ingredient 1 and Ingredient 2 info. I want to pull into that sheet the results from Column E "Output" below.

So when the info in my dataset equals "929062" and "926664" it returns 0.01. And then when it equals "929429" and "926664" it will return whatever is in column E "Output" even though the "92664" is shared between different values in Column A. In this case they're the same but typically they are different (if that helps).

 

example.PNG

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @eburg 

 

You can try the following methods.

Column = 
IF (
    [Ingredient 1] = 929062
        && [Ingredient 2] = 926664,
    0.01,
    IF (
        [Ingredient 1] = 929429
            && [Ingredient 2] = 926664,
        MAX ( 'Table'[Output] ),
        BLANK ()
    )
)

vzhangti_0-1639469248469.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

 

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @eburg 

 

You can try the following methods.

Column = 
IF (
    [Ingredient 1] = 929062
        && [Ingredient 2] = 926664,
    0.01,
    IF (
        [Ingredient 1] = 929429
            && [Ingredient 2] = 926664,
        MAX ( 'Table'[Output] ),
        BLANK ()
    )
)

vzhangti_0-1639469248469.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @eburg 

 

Try this to add a new column:

Column=
IF([Ingredient 1]=929062&&[Ingredient 2]=926664,0.01,[Output])

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors