Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
if under the same value in one column the values are the same in another column
This is what my table looks like:
code | code2 | country |
1234 | 8945 | USA |
1234 | 8944 | France |
2345 | 3666 | Canada |
5678 | 7654 | Africa |
5678 | 7655 | Africa |
I have codes and their respective countries, I want to check if the same codes have same countries and if not then I wanna flag those codes, codes can repeat by codes2 wont. Code2 can have same codes
eg: 1234 has two countries; USA and France so I need to flag that but 5678 has the same so it's fine.
desired output:
code | code2 | country | Indicator |
1234 | 8945 | USA | Different |
1234 | 8944 | France | Different |
2345 | 3666 | Canada | OK |
5678 | 7654 | Africa | OK |
5678 | 7655 | Africa | OK |
Please help
Solved! Go to Solution.
Hi @123117 ,
You can try this:-
Indicator =
VAR result =
COUNTROWS (
FILTER (
'Table',
'Table'[code] = EARLIER ( 'Table'[code] )
&& 'Table'[country] <> EARLIER ( 'Table'[country] )
)
)
RETURN
IF ( ISBLANK ( result ), "Ok", "Different" )
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi @123117 ,
You can try this:-
Indicator =
VAR result =
COUNTROWS (
FILTER (
'Table',
'Table'[code] = EARLIER ( 'Table'[code] )
&& 'Table'[country] <> EARLIER ( 'Table'[country] )
)
)
RETURN
IF ( ISBLANK ( result ), "Ok", "Different" )
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi
thanks!
I'm trying and I'm getting this error
EARLIER/EARLIEST refers to an earlier row context which doesn't exist.
this works! thnx
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
90 | |
88 | |
83 | |
64 | |
49 |
User | Count |
---|---|
127 | |
108 | |
87 | |
70 | |
66 |