Reply
jeroenwmwillems
Advocate I
Advocate I

Return value with certain conditions, if another condition is true

Hi all,

 

I'm trying to get PowerBI to do something with a formula that's a bit over my head, was hoping you'd be able to help:

I want to have a column in my file, which returns a value for a specific user, that is dependant on some other conditions. To make it clearer, I made the example file below. 

I'd like to return the colour a user had, when they ordered the first time, to be returned in 'column wanted'.

So the formula would have to do the following things: 

Match the user ID with the User ID in the row, and then confirm that first time = yes. For the value where this is true, it should return the colour in the 'column wanted'. So practically, in this example, all rows for 'User 2' would have 'Red' in the 'column wanted'.

 

Any help is much appreciated!

 

 
 

examplefile.PNG

1 ACCEPTED SOLUTION
Nathaniel_C
Community Champion
Community Champion

Hi @jeroenwmwillems ,

 

measure =
CALCULATE (
    MAX ( table[Colour] ),
    ALLEXCEPT ( table, table[USER] ),
    table[First Time] = "Yes"
)

 

Try this.
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
Nathaniel_C
Community Champion
Community Champion

Hi @jeroenwmwillems ,

 

measure =
CALCULATE (
    MAX ( table[Colour] ),
    ALLEXCEPT ( table, table[USER] ),
    table[First Time] = "Yes"
)

 

Try this.
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks Nathaniel, works like a charm.

 

You're a champ! @Nathaniel_C 

Thank you, you are welcome!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Nathaniel_C
Community Champion
Community Champion

Hi @jeroenwmwillems ,

Would you copy and paste the data instead of a picture, so we create a pbix? Thank you, Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




avatar user

Helpful resources

Announcements
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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)