Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

check if value exists in multiple columns

Hi Guys,

 

Need your help on powerbi desktop please. 

 

I am trying to workout a calculation to check mutiple column status for each row; if any of the column has 1 or more "Expired" status, in the result colum should reflect as "Expired" if not should reflect as "Valid". Please assist.

 

IDStatus1Status2Status3Status4Status5Result
Employee1ExpiredExpired1 MonthExpired2 Months 
Employee2Expired1 MonthExpired1 Month1 Month 
Employee31 Month1 Month1 Month1 MonthExpired 
Employee43 Months3 Months3 Months3 Months3 Months 
Employee51 MonthExpired1 MonthExpired1 Month 
Employee6Expired1 MonthExpired1 Month1 Month 
Employee73 Months1 Month1 Month1 Month1 Month 
Employee81 Month1 Month1 Month1 Month1 Month 
Employee9Expired1 Month1 Month1 Month1 Month 
Employee103 Months3 Months3 Months3 Months3 Months 
  • Hi Anonymous ,

    You can use the below DAX

    Result = IF('Table'[Status1] = "Expired" || 'Table'[Status2] = "Expired" || 'Table'[Status3] = "Expired" || 'Table'[Status4] = "Expired" || 'Table'[Status5] = "Expired", "Expired", "Valid")

    Output will be as shown below

     

1 Reply

  • Hi Anonymous ,

    You can use the below DAX

    Result = IF('Table'[Status1] = "Expired" || 'Table'[Status2] = "Expired" || 'Table'[Status3] = "Expired" || 'Table'[Status4] = "Expired" || 'Table'[Status5] = "Expired", "Expired", "Valid")

    Output will be as shown below