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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Renato_mon
Regular Visitor

Group by text and result only differences.

Hello,

 

I'd like to group by text and result only the differences between each grouped row.

I appreciate the help!

Thanks

 

The result I expect:

ProductmarketPart
x1AX2ZZZ
x2AX2GGG
x2AX2YYY

 

My DB exemple:

ProductmarketPart
x1AX1AAA
x1AX1BBB
x1AX1CCC
x1AX1DDD
x1AX1EEE
x1AX1FFF
x1AX2AAA
x1AX2BBB
x1AX2CCC
x1AX2DDD
x1AX2EEE
x1AX2FFF
x1AX2ZZZ
x2AX1AAA
x2AX1BBB
x2AX1CCC
x2AX1DDD
x2AX1EEE
x2AX1FFF
x2AX2AAA
x2AX2BBB
x2AX2CCC
x2AX2DDD
x2AX2EEE
x2AX2FFF
x2AX2GGG
x2AX2YYY
1 ACCEPTED SOLUTION
AlienSx
Super User
Super User

Hi, @Renato_mon 

let
    Source = your_table,
    g = Table.Group(Source, "Part", {{"Count", each Table.RowCount(_)}, {"a", each _}}),
    flt = Table.SelectRows(g, each ([Count] = 1)),
    z = Table.Combine(flt[a])
in
    z

View solution in original post

4 REPLIES 4
AlienSx
Super User
Super User

Hi, @Renato_mon 

let
    Source = your_table,
    g = Table.Group(Source, "Part", {{"Count", each Table.RowCount(_)}, {"a", each _}}),
    flt = Table.SelectRows(g, each ([Count] = 1)),
    z = Table.Combine(flt[a])
in
    z
jgordon11
Resolver II
Resolver II

let
    Source = --- code for your source table ---,
    tbl = Table.NestedJoin(Source, {"Product", "Part"}, Source, {"Product", "Part"}, "Join", JoinKind.LeftOuter),
    tbl1 = Table.RemoveColumns(Table.SelectRows(tbl, each Table.RowCount([Join]) =1), {"Join"})
in
    tbl1
nickvanmaele
Advocate II
Advocate II

Hi @Renato_mon 

 

When you say "difference", please define exactly what that means.

 

If I would add two more lines to the table, (x1, AX2, MMM) and (x2, AX2, MMM), what would be the expected result?

 

What if I did not add the above two lines, but (x1, AX1, MMM) and (x2, AX2, MMM), what would be the expected result?

Hi @nickvanmaele 

 

"Difference" means only value that are unique in all Product and Market.

In the both question, the result will be the same. The Part MMM will use in two Product/Market.

Write in the other way with 2 examples:

Renato_mon_0-1683407742907.png

 

My DB have about 100 Products for 10 Markets, each one with about 150 Parts (15000 rows).

I hope was clear with my doubt.

Thanks!

 

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.