March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi All,
I have data model like this:
I want to create a calculated column "JP1 or JP2" which would return the values "JP1" or "JP2" based on Job Info table. Lets say, I select Partner Name = Gilbert in my report, my calculation would first look for Gilbert's PartnerId in Partner Info Table and then check if this value is in column "JobPartner1Id" or "JobPartner2Id" for the condition that Relationship = "Managed".
I tried this dax =
Solved! Go to Solution.
Hi @Saloni_Gupta ,
Here are the steps you can follow:
1. Create measure.
Flag =
var _select=SELECTEDVALUE('Partner Info'[Parner Name])
var _selectID=MAXX(FILTER(ALL('Partner Info'),'Partner Info'[Parner Name]=_select),[PartnerId])
return
IF(
MAX('PartnerJob Relationship'[Partner Id])=_selectID&&MAX('PartnerJob Relationship'[Relationship])="Managed",1,0)
JP1 or JP2 =
var _column1=SELECTCOLUMNS('Job Info',"1ID",'Job Info'[JobPartner1Id])
var _column2=SELECTCOLUMNS('Job Info',"2ID",'Job Info'[JobPartner2Id])
return
IF(
MAX('PartnerJob Relationship'[Partner Id]) in _column1 ,"JP1",
IF(
MAX('PartnerJob Relationship'[Partner Id]) in _column2,"JP2",BLANK()))
2. Place [Flag]in Filters, set is=1, apply filter.
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Saloni_Gupta ,
Here are the steps you can follow:
1. Create measure.
Flag =
var _select=SELECTEDVALUE('Partner Info'[Parner Name])
var _selectID=MAXX(FILTER(ALL('Partner Info'),'Partner Info'[Parner Name]=_select),[PartnerId])
return
IF(
MAX('PartnerJob Relationship'[Partner Id])=_selectID&&MAX('PartnerJob Relationship'[Relationship])="Managed",1,0)
JP1 or JP2 =
var _column1=SELECTCOLUMNS('Job Info',"1ID",'Job Info'[JobPartner1Id])
var _column2=SELECTCOLUMNS('Job Info',"2ID",'Job Info'[JobPartner2Id])
return
IF(
MAX('PartnerJob Relationship'[Partner Id]) in _column1 ,"JP1",
IF(
MAX('PartnerJob Relationship'[Partner Id]) in _column2,"JP2",BLANK()))
2. Place [Flag]in Filters, set is=1, apply filter.
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @v-yangliu-msft
Thanks for your reply,
I have one question here - what if I dont want to show the column "Relationship" in the final table, I dont think the Flag calculation would display any result. Is there any way to modify the dax to still work when Relationship column is not shown?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
86 | |
73 | |
57 | |
52 |
User | Count |
---|---|
197 | |
133 | |
107 | |
69 | |
65 |