Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

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

Anonymous
Not applicable

@Anonymous  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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors