Question to filter usage in Power BI

luftpolster

New Member
Joined
Oct 12, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm trying to filter the duplicates in the column "TYPE" to show the ones which are having the "NR" of 2 and another number.

In this example that would be the lines 2,3 and 4,5 because the lines are duplicates in the TYPE column and have the NR "2" and one or more other numbers in the NR column.

Does anyone know how I could filter this in Power BI?


LINETYPENR
1A1
2B2
3B1
4C2
5C3
6A3
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    ChangeType = Table.TransformColumnTypes(Source,{{"LINE", Int64.Type}, {"TYPE", type text}, {"NR", Int64.Type}}),
    GroupRows = Table.Group(ChangeType, {"TYPE"}, {{"tbl", each _, type table [LINE=nullable number, TYPE=nullable text, NR=nullable number]}}),
    AddConditionalColumn = Table.AddColumn(GroupRows, "Custom", each if 
        List.Contains([tbl][NR],2) and [tbl][NR] <> List.Repeat({2},List.Count([tbl][NR])) then 1 else 0),
    FilterRows = Table.SelectRows(AddConditionalColumn, each ([Custom] = 1)),
    ExpandNR = Table.ExpandTableColumn(FilterRows, "tbl", {"LINE", "NR"}, {"LINE", "NR"}),
    ReorderColumns =  Table.RemoveColumns(Table.ReorderColumns(ExpandNR,{"LINE", "TYPE", "NR"}),{"Custom"})
in
    ReorderColumns
 
Upvote 0

Forum statistics

Threads
1,223,697
Messages
6,173,896
Members
452,536
Latest member
Chiz511

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top