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

Power bi dax for compare two column values

Hi All

 

I am facing a challenge to create a measure as a flag to compare two column values. 

samz_0-1597288532292.png

here i want to check if one capability_id has different milestone_id and setting as a flag like if milestone_id is blank then 1 or else 0.

Please help me on this. 

thanks

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

You may create measure like DAX below.

 

Flag =

var _CountDiff= CALCULATE(COUNT(Table1[milestone_id]), ALLEXCEPT(Table1, Table1[capability_id]))

Return

SUMX(Table1, IF(_CountDiff>=2 , 1, 0))

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous ,

Not very clear , Try a new column like

if(isblank([Milestone_id]),1,0)

Anonymous
Not applicable

@amitchandak 

i want to campare with capability_id , if one capability_id has two values in milestone_id then need to set flag. 

 

milestone_idcapability_idflag
NullC1230
M1C1231
NullC3242

@Anonymous , Logic is not clear

pranit828
Community Champion
Community Champion

Hi @Anonymous 

 

Hope, you would like to try the conditional column option in Power Query Editor to create a new column as shown below.

Power Query Editor --> Add Column --> Conditional Column

pranit828_0-1597289618151.png

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Regards,
Pranit





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
Anonymous
Not applicable

@pranit828  its a live connection to cube as dot able to see those settings

Hi @Anonymous ,

 

You may create measure like DAX below.

 

Flag =

var _CountDiff= CALCULATE(COUNT(Table1[milestone_id]), ALLEXCEPT(Table1, Table1[capability_id]))

Return

SUMX(Table1, IF(_CountDiff>=2 , 1, 0))

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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.