1
votes

I have a requirement where I have to check for each category, and if for that category any flag is "Yes', then I need another column which says "True" for all values of that category.

eg.

Column1    Flag     Final_Answer
A          Yes      True
A          No       True
A          No       True
B          No       False
B          No       False
C          No       False

Notice that only if a category in Column1 has the value "Yes" in Flag then Final_Answer will be "True" for all the rows for the category. Since, "B" and "C" do not have "Yes', the corresponding value in Final_answer is "False:.

How can I achieve this in DAX powerbi? Any help is appreciate. Thanks

1

1 Answers

4
votes

Sure, you need to run a calculate to help iterate over the rest of the table.

CalculatedFinalAnswer = 

VAR col = TheTable[Column1]
RETURN IF (CALCULATE(COUNTROWS(TheTable), ALL(TheTable), FILTER(TheTable, TheTable[Column1] = col), FILTER(TheTable, TheTable[Flag] = "Yes")), TRUE(), FALSE()) 

I added an index column from PowerQuery to help with display.

enter image description here