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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors
Top Kudoed Authors