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
powerbisach
Helper I
Helper I

Result based on conditions on a group.

I have this table with unique jobs,group and different colours. What i need a calculated column which will check for all unique group and jobs and condition on colours with group. If any of the record fulfills the colour condtion the rest records should be updated with the same result.

GroupColoursJobsConditionExpected Result
1REDJob1Unique group and unique Jobs search for "Red" color in all the records, if found set the result to REDRED
1BLUEJob1 RED
1BLUEJob1 RED
2GrayJob2Unique group and unique Jobs search for "Gray" color in all the records, if found set the result to REDGray
2BackJob2 Gray

 

How to achieve this using calculated column or measure. Appreciate quick response

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@powerbisach,

Please create the following columns in your table.

Column = CALCULATE(CONCATENATEX(VALUES(Table1[Colours]),Table1[Colours],","),ALLEXCEPT(Table1,Table1[Group]))
check = IF(IFERROR(SEARCH("RED",Table1[Column]),-1)>0,"RED",IF(IFERROR(SEARCH("Gray",Table1[Column]),-1)>0 ,"Gray"))

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
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
powerbisach
Helper I
Helper I

@v-yuezhe-msft

 

Thanks for your reply. Your solution approach looks perfect.

 

I have huge data, so for search i need to write multiple conditions. Is there a way i can pass conditions dynamically to search, rather than giving each condition seperately.

 

 

@powerbisach,


No. You would need to write all possible conditions in the DAX.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yuezhe-msft
Employee
Employee

@powerbisach,

Please create the following columns in your table.

Column = CALCULATE(CONCATENATEX(VALUES(Table1[Colours]),Table1[Colours],","),ALLEXCEPT(Table1,Table1[Group]))
check = IF(IFERROR(SEARCH("RED",Table1[Column]),-1)>0,"RED",IF(IFERROR(SEARCH("Gray",Table1[Column]),-1)>0 ,"Gray"))

1.PNG

Regards,
Lydia

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

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.