The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello world,
so I have been using analysis services in power bi and I want to compare 2 string columns.
The 2 string columns come from different DIM tables of the model, that are being combined through a FACT table.
I want to compare those two columns somehow, but unfortunately , no matter what I've tried didn't work.
Initially I used this:
Solved! Go to Solution.
Hi @Anonymous ,
If you have columns like [ID] to create relationships between two tables, you can try to create a measure like this and set the visual filter:
Check =
IF (
CONTAINS (
VALUES ( 'Table11'[Requester] ),
'Table11'[Requester], SELECTEDVALUE ( Table22[PO Creator] )
),
"OK",
"Not OK"
)
Table visual would not show the duplicated row if not put separate column in it:
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
If you have columns like [ID] to create relationships between two tables, you can try to create a measure like this and set the visual filter:
Check =
IF (
CONTAINS (
VALUES ( 'Table11'[Requester] ),
'Table11'[Requester], SELECTEDVALUE ( Table22[PO Creator] )
),
"OK",
"Not OK"
)
Table visual would not show the duplicated row if not put separate column in it:
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , Try like
Table 2 =
var combinetable = ADDCOLUMNS('Fact - Purchase Orders',"Requestor",RELATED(
'Dim - Purchase Requisitions'[Requisition Preparer]
),"Preparer",RELATED('Dim - Purchase Orders'[PO Header Created By]
))
return
Can you share sample data and sample output in table format?
Requester PO Creator Output
CGC CGC 1
CGC KLP 0
OTI OTI 1
OTI VLS 0
CGC CGC 1
VLS VLS 1
KLP 0
This is some sample data, bear in mind the constraints mentioned on the initial message.
Thanks @amitchandak
@Anonymous , Try a measure like where 'Fact - Purchase Orders'[ID] is there level where you want to compare these names, replace with the correct name
New measure = countx(values('Fact - Purchase Orders'[ID]),If( RELATED('Dim - Purchase Requisitions'[Requisition Preparer]) =RELATED('Dim - Purchase Orders'[PO Header Created By]) ,1,0))
Could this also be changed to show instead of 1 and 0, "OK" & "Not OK", as I've tried it and still shows numbers