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
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
Super User
Super User

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
Super User
Super User

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
Super User
Super User

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!




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.