Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
webportal
Impactful Individual
Impactful Individual

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
Anonymous
Not applicable

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

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

can you do the distinct also only based on 1 column ? I struggle with this because I have a column that I want to use as key for a 1:m relationship...the table variable is built using summarizecolumns

Thanks

webportal
Impactful Individual
Impactful Individual

DISTINCT does it.
Thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.