Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I have a table where I have used a DAX formula to determine if a row is a "duplicate" by counting the number of occurrences. In this scenario, a duplicate is when the values of Fruit and Color in one row both match the values for Fruit and Color in another row.
Table1
Fruit | Color | Occurences |
Apple | Red | 1 |
Apple | Green | 3 |
Grape | Purple | 2 |
Apple | Green | 3 |
Grape | Green | 1 |
Apple | Green | 3 |
Grape | Yellow | 1 |
Apple | Yellow | 1 |
Grape | Purple | 2 |
Fruit | Color | Occurrences |
Apple | Green | 3 |
Grape | Purple | 2 |
Thanks in advance.
Solved! Go to Solution.
Hi,
I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
It is for creating a new table.
Expected table =
SUMMARIZE(
FILTER(
ADDCOLUMNS(
Table1,
"@occurences", VAR _CurrentFruit = 'Table1'[Fruit]
VAR _CurrentColor = 'Table1'[Color]
RETURN
COUNTROWS(FILTER(
'Table1',
'Table1'[Fruit] = _CurrentFruit &&
'Table1'[Color] = _CurrentColor
)
)
),
[@occurences] > 1
),
Table1[Fruit],
Table1[Color],
[@occurences]
)
Hi,
I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
It is for creating a new table.
Expected table =
SUMMARIZE(
FILTER(
ADDCOLUMNS(
Table1,
"@occurences", VAR _CurrentFruit = 'Table1'[Fruit]
VAR _CurrentColor = 'Table1'[Color]
RETURN
COUNTROWS(FILTER(
'Table1',
'Table1'[Fruit] = _CurrentFruit &&
'Table1'[Color] = _CurrentColor
)
)
),
[@occurences] > 1
),
Table1[Fruit],
Table1[Color],
[@occurences]
)
Thank you @Jihwan_Kim ! It seems to provide the correct answer for me, but I want to be sure I applied it as you intended. I created a new measure and used this to get "2" as my value. As it's my first time using "Summarize", it's new to me. It's interesting to see that I can generate a virtual table, I didn't know about this functionality.
# Distinct Duplicates =
VAR _Table = SUMMARIZE(
FILTER(
ADDCOLUMNS(
Table1,
"@occurences", VAR _CurrentFruit = 'Table1'[Fruit]
VAR _CurrentColor = 'Table1'[Color]
RETURN
COUNTROWS(FILTER(
'Table1',
'Table1'[Fruit] = _CurrentFruit &&
'Table1'[Color] = _CurrentColor
)
)
),
[@occurences] > 1
),
Table1[Fruit],
Table1[Color],
[@occurences]
)
RETURN COUNTROWS(_Table)
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
24 | |
19 | |
14 | |
10 | |
7 |