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
Anonymous
Not applicable

DAX

HI, 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 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous , 

You could change @amitchandak 's expression like below, it is calculated column

Column = if(isblank(countx(filter('Table', [Column1] = earlier([Column1]) && [Flag] ="Yes"),[Column1])),"False", "True")

Or you also could try to use measure to achieve this.

Measure = if(CALCULATE(DISTINCTCOUNT('Table'[Flag]),ALLEXCEPT('Table','Table'[Column1]))>1,"True", "False")

 803.PNG

Best Regards,
Zoe Zhi

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

@Anonymous , Try a new column like

new column = isblank(countx(filter(Table, [Column1] = earlier([Column1]) && [Flag] ="Yes"),[Column1]),"No","Yes")

Anonymous
Not applicable

Hi Amit, Thanks for replying. But, im getting errors on the last part of your DAX query. Could you please check once? Thanks

dax
Community Support
Community Support

Hi @Anonymous , 

You could change @amitchandak 's expression like below, it is calculated column

Column = if(isblank(countx(filter('Table', [Column1] = earlier([Column1]) && [Flag] ="Yes"),[Column1])),"False", "True")

Or you also could try to use measure to achieve this.

Measure = if(CALCULATE(DISTINCTCOUNT('Table'[Flag]),ALLEXCEPT('Table','Table'[Column1]))>1,"True", "False")

 803.PNG

Best Regards,
Zoe Zhi

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.