Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello.
I have been tossed a project that I feel a little in over my head on. I have been trying to puzzle this out today, I feel like I am starting to understand some of what I need to do. But part of it escapes me. Simply comparing has been easy to figure out. But having to look at this as a composite value is throwing me. Any tips, help or otherwise is very much appreciated. I have a set of data that has a series of ID numbers and a corresponding Text field.
What I am attempting to do, is create a check column that will help me identify duplicated combination values. So for each Pair, I want to know if there is another identical pair within the data set.
So for each row. It needs to look at the Number value and the Text. Then for each time the same number value is present. It needs to check if that first text was also present. If it is, I would like it to indicate that with a True False. Something like that. Lets say this first table is an example. The combination of Number = 1 and Text = Text 1 occurs twice. In my first row and my 5th row. So next to each of those rows, in my new column I would want it to display True. Any others that don't match it can say false.
Number | Text |
1 | Text 1 |
2 | Text 2 |
3 | Text 3 |
4 | Text 4 |
1 | Text 1 |
2 | Text 1 |
3 | Text 3 |
4 | Text 2 |
1 | Text 3 |
Ideally looking something like this. Row 1 matches Row 5, so they are true. Row 3 matches with row 7, so they are true as well.
Number | Text | Duplicate |
1 | Text 1 | True |
2 | Text 2 | False |
3 | Text 3 | True |
4 | Text 4 | False |
1 | Text 1 | True |
2 | Text 1 | False |
3 | Text 3 | True |
4 | Text 2 | False |
1 | Text 3 | False |
Solved! Go to Solution.
Hi @IDAronson ,
@FreemanZ was basically right, but there were some minor mistakes
Duplicate =
VAR CurrentText='Table'[text]
VAR CurrentNumber='Table'[number]
VAR _count = COUNTROWS(
FILTER(
'Table',
'Table'[number]=CurrentNumber && 'Table'[text]=CurrentText
)
)
RETURN
IF(_count>=2, true, false)
Best Regards,
Gallen Luo
Hi @IDAronson ,
@FreemanZ was basically right, but there were some minor mistakes
Duplicate =
VAR CurrentText='Table'[text]
VAR CurrentNumber='Table'[number]
VAR _count = COUNTROWS(
FILTER(
'Table',
'Table'[number]=CurrentNumber && 'Table'[text]=CurrentText
)
)
RETURN
IF(_count>=2, true, false)
Best Regards,
Gallen Luo
Thank you so much. Appreciate the help. Now I need to make sure I fully understand how this works so that I can do it myself next time.
Aha, thanks for pointing out. FILTER can't take logic test argument like that.
It needs to be:
'Table'[number]=CurrentNumber && 'Table'[text]=CurrentText
or
AND(Data[Number]=CurrentNumber, Data[Text]=CurrentText))
Listing multiple logic test arguments is more common with CALCULATE.
Thanks for the help. This got me close. Then with Gallen's help that took me the rest of the way. Appreciate your help.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
37 | |
25 | |
19 | |
14 | |
8 |
User | Count |
---|---|
69 | |
48 | |
44 | |
19 | |
15 |