Forum Discussion
Checking for Partial Row Matches in the Same Table
- 6 years ago
Hi ndeshpande
You could add it as a new column:Match_Found_Col = VAR cl = [Client_name] VAR sl = [Send_location] VAR rl = [Receive_location] VAR c = COUNTROWS ( CALCULATETABLE ( VALUES ( ClientOrders ), FILTER ( ALL ( ClientOrders ), [Send_location] = sl && [Receive_location] = rl && [Client_name] <> cl ) ) ) + 0 RETURN IF ( c > 0, TRUE (), FALSE () )
Or as a measure:Match_Found_Mes = VAR cl = FIRSTNONBLANK ( ClientOrders[Client_name], 1 ) VAR sl = SELECTEDVALUE ( ClientOrders[Send_location], "123" ) VAR rl = SELECTEDVALUE ( ClientOrders[Receive_location], "123" ) VAR c = COUNTROWS ( CALCULATETABLE ( VALUES ( ClientOrders ), FILTER ( ALL ( ClientOrders ), [Send_location] = sl && [Receive_location] = rl && [Client_name] <> cl ) ) ) + 0 RETURN IF ( c > 0, TRUE (), FALSE () )Cheers
Edit: Ah, sorry parry2k , I hadn't seen your answer.
ndeshpande you can try following method
Add new column and measure and measure will return true/false
Receive and Send Column = 'Table'[Receive_location] & 'Table'[Send_location]
Is Exist Measure =
VAR __current = VALUES ( 'Table'[Receive and Send Column] )
VAR __client = SELECTEDVALUE ( 'Table'[Client_name] )
VAR __other = CALCULATETABLE ( VALUES ( 'Table'[Receive and Send Column] ), ALL ( 'Table'[Receive and Send Column] ), 'Table'[Client_name] <> __client )
VAR __isExist = CALCULATE ( COUNTROWS ( 'Table' ), INTERSECT ( __other, __current ) ) + 0
RETURN
IF ( __isExist = 0, "False", "True" )
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
- ndeshpande6 years agoFrequent Visitor
Thanks for the quick response, I was thinking I'll probably need to convert the measure to a column. However the combining the relevant separate column values into a single colum was a great idea because it will simplify my searches later on.
Thank you!