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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Grouping column data for filter

Hi Guys

 

I need help grouping data to add to a filter, the column im trying to group is the item number as per below:ItemCol.PNG

 

I have tried using the below switch statement, but this adds the 4 items to the category "Online" and it does not appear in "Warehouse" category, where those items are available both in "Online" and "Warehouse"

 

Stock = SWITCH(
TRUE(),
ICITEM[Item Number] In {"ACCE22304","ASCC22104","ASCC22204","ASCC22304"},"Online",
"Warehouse"
)

 

Any recommendations, that will allow grouping to a category called, "Online" while at the same time making sure that the category "Warehouse" still includes all item numbers.

 

 

4 REPLIES 4
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous

 

You may try to add a slicer table as below. Then you may create a test measure and drag it to visual level filter to get the table as requested.

test =
IF (
HASONEVALUE ( 'Check Stock'[Check Stock] ),
IF (
SELECTEDVALUE ( 'Check Stock'[Check Stock] ) = "Online"
&& MAX ( 'Sample'[Item Number] ) IN { "ASCC22104", "ASCC22204" }
|| SELECTEDVALUE ( 'Check Stock'[Check Stock] ) = "Warehouse",
1
),
1
)

1.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
petrovnikitamai
Resolver V
Resolver V

try to add new table for mapping

like

 

mapping = 
var online = {"ACCE22304";"ASCC22104";"ASCC22204";"ASCC22304"}
return 
UNION(
    GENERATE(SELECTCOLUMNS({"Online"};"status";{"Online"});online);
    GENERATE(SELECTCOLUMNS({"Warehouse"};"status";{"Warehouse"});VALUES(ICITEM[Item Number])))

sometimes u can get a cycle error. in this way try to get list with unique Item Number values from other table (instead VALUES(ICITEM[Item Number]) use VALUES(OtherTable[Item Number]).

for each status list of values

image.png

And create relationships between your main table and mapping table by Item Number column

then u can use field "status' for filtering your main table

affan
Solution Sage
Solution Sage

Hi @Anonymous

 

Can you elaborate this a little more? As your data is not showing anything in regards to Online or Warehouse

 

 

Regards

Affan

Anonymous
Not applicable

Hi Affan

 

Please read through my problem again, ill be using the categories i create "Online" and "Warehouse" in a filter like this:

 

ItemCol.PNG

 

I need to group column data, example "ASCC22104" and "ASCC22204" grouped as "Online", so i can use filter to only see those 2 items.

 

The 2 items should still be included in "Warehouse" which includes all items.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors