cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors