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
MMAKSATULY
Regular Visitor

Filtering a table by one of its columns

Hi everyone. 

I could not find such a problem on the forum or on the Internet (there are similar problems but there are two or more source tables).

I need any help to filter the source table. In the source table there is a product category and each product has its own key. I would like to filter the source table so that only those products that match the product key with category C remain there. Now I filter separately category C into the table. And then, through the merge, I sort the source into categories A and B. But I can’t combine it all into one table back because of the loop.

I would like all three categories to be in one table and only the same keys as category C products.

Please tell me if it is possible to implement this in power query without cycling error? 

Please see the attachment.  https://drive.google.com/drive/folders/1kmHK3V9MkjHEfyqa7Za8v_G1vXbf4IOK?usp=sharing  Change the location of the excel file in the "filename" parameter.  

RegionProductStoreCategoryPriceNeedDistributionProduct on the wayMonthkey
SD8966012183520A561,4801 01.08.223520896601218
SD8966012243520A214,1701 01.08.223520896601224
SD8966012253520A121,2801 01.08.223520896601225
UU701003191205C1,5911 01.08.22120570100319
UU1101013101205C11,6511 01.08.221205110101310
UU1103010171205C19,5711 01.08.221205110301017
KN304071653510B0,7311 01.10.22351030407165
KN710050233510B21,0711 01.12.22351071005023
KN1100010693510B1,4111 01.11.223510110001069
1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

=let a=Table.SelectRows(PreviousStepName,each [Category]="C"), b=List.Buffer(a[key]) in a&Table.SelectRows(PreviousStepName,each List.Contains(b,[key]))

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

=let a=Table.SelectRows(PreviousStepName,each [Category]="C"), b=List.Buffer(a[key]) in a&Table.SelectRows(PreviousStepName,each List.Contains(b,[key]))

JamesRobson
Resolver II
Resolver II

Hi,

 

 Not sure I follow are you looking to fitler on 2 seperate criteria at the same time? i.e.

= Table.SelectRows(#"Changed Type", each ([Product Code] = 123) and ([Category] = "C"))

 

This would show you any line where Product Code = 123 but only if Category = C

If thats not right can you give example of what you are trying to achieve/expect to see.

 

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.

Top Solution Authors