Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Check if column contains specific based on other column grouping

Hallo

 

I am looking for a way to calculate the column "HasSuccess" in the table below given the two other columns "ItemID" and "ItemStatus". If an ItemID has a successful status, I want it to return True and otherwise return False.

 

ItemIDItemStatusHasSuccess
1SuccessTrue
1FailTrue
1SuccessTrue
2FailFalse
2FailFalse
3SuccessTrue
4FailTrue
4SuccessTrue
5FailFalse

 

Thanks

4 Replies

  • Hi Anonymous ,

     

    You can create a column using DAX expresion as follows:

     

    CalcValue =

    IF(COUNTROWS(FILTER(ALL(Table), (Table[ItemID] = EARLIER(Table[ItemID])) && Table[ItemStatus] = "Succes")) > 0, "True", "False")
     
    In the above DAX replace Table with your tablename.
     
    If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂
     
    Thanks,
    Pragati

     

  • Anonymous , try as a new column

    new column = if(countx(filter(table[ItemID] =earlier(Table[ItemID]) && Table[ItemStatus] = "Success"),table[ItemID)>0,"True","False")