cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
webportal Member
Member

Remove duplicates in summarize table

I want to remove duplicate rows of a union of two tables using DAX.

 

This is my code:

Global = 
VAR Table1= SUMMARIZE(GLAccounts;GLAccounts[AccountID];GLAccounts[AccountDescription];GLAccounts[Name];GLAccounts[GroupingCode];GLAccounts[ChaveConta])
Var Table2= SUMMARIZE(GLEntries;GLEntries[AccountID];GLEntries[AccountDescription];GLEntries[Name];GLEntries[GroupingCode];GLEntries[ChaveConta])
RETURN
UNION(Table1;Table2)

 

I know if I create another summarize table over this one, I'll remove the duplicates, but isn't there a way to do the whole thing in a single table?

 

Thanks for helping!

1 ACCEPTED SOLUTION

Accepted Solutions
ThomasFoster Established Member
Established Member

Re: Remove duplicates in summarize table

DISTINCT () should work for you. Although be aware that as with DAX in general it will be case insensitive.

 

example

 

EVALUATE
VAR _Table =
    DATATABLE (
        "Column1", STRING,
        "Column2", STRING,
        "Column3", INTEGER,
        {
            { "A", "a", 1 },
            { "A", "A", 1 },
            { "A", "B", 2 },
            { "A", "B", 2 }
        }
    )
RETURN
    DISTINCT ( _Table )

returns

Column 1, Column2, Column3
"A", "a", 1
"B", "B", 2
2 REPLIES 2
ThomasFoster Established Member
Established Member

Re: Remove duplicates in summarize table

DISTINCT () should work for you. Although be aware that as with DAX in general it will be case insensitive.

 

example

 

EVALUATE
VAR _Table =
    DATATABLE (
        "Column1", STRING,
        "Column2", STRING,
        "Column3", INTEGER,
        {
            { "A", "a", 1 },
            { "A", "A", 1 },
            { "A", "B", 2 },
            { "A", "B", 2 }
        }
    )
RETURN
    DISTINCT ( _Table )

returns

Column 1, Column2, Column3
"A", "a", 1
"B", "B", 2
webportal Member
Member

Re: Remove duplicates in summarize table

DISTINCT does it.
Thanks!