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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Jay2022
Helper IV
Helper IV

Grouping products together by count less than 5 = other

I'm trying to build a bar chart of products showing all and then grouping all those where teh count is less than 5 into a category called other. Any idea how i can do this ?

 

2 ACCEPTED SOLUTIONS
moncx
Resolver II
Resolver II

Hey,

 

there is older post on this topic in this forum, have you tried the solution provided here: Solved: Create miscellaneous/other group using count below... - Microsoft Fabric Community

 

 

Hope it helps!

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Jihwan_Kim
Super User
Super User

Hi, I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1727294346803.png

 

 

Jihwan_Kim_0-1727294311445.png

 

 

count measure with other category: = 
VAR _allcount =
    CALCULATE ( [count measure:], REMOVEFILTERS ( product_dimension ) )
VAR _lessthanfiveall =
    SUMX (
        FILTER (
            ADDCOLUMNS (
                ALL ( product_dimension[product], product_dimension[Index] ),
                "@count", [count measure:]
            ),
            [@count] < 5
        ),
        [@count]
    )
VAR _moreorequaltofivelist =
    SUMMARIZE (
        FILTER ( VALUES ( product_dimension[product] ), [count measure:] >= 5 ),
        product_dimension[product]
    )
RETURN
    SWITCH (
        TRUE (),
        SELECTEDVALUE ( product_dimension[product] ) = "other", _lessthanfiveall,
        SELECTEDVALUE ( product_dimension[product] ) IN _moreorequaltofivelist, [count measure:],
        NOT HASONEVALUE ( product_dimension[product] ), [count measure:]
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
Jay2022
Helper IV
Helper IV

Thank you both

Jihwan_Kim
Super User
Super User

Hi, I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1727294346803.png

 

 

Jihwan_Kim_0-1727294311445.png

 

 

count measure with other category: = 
VAR _allcount =
    CALCULATE ( [count measure:], REMOVEFILTERS ( product_dimension ) )
VAR _lessthanfiveall =
    SUMX (
        FILTER (
            ADDCOLUMNS (
                ALL ( product_dimension[product], product_dimension[Index] ),
                "@count", [count measure:]
            ),
            [@count] < 5
        ),
        [@count]
    )
VAR _moreorequaltofivelist =
    SUMMARIZE (
        FILTER ( VALUES ( product_dimension[product] ), [count measure:] >= 5 ),
        product_dimension[product]
    )
RETURN
    SWITCH (
        TRUE (),
        SELECTEDVALUE ( product_dimension[product] ) = "other", _lessthanfiveall,
        SELECTEDVALUE ( product_dimension[product] ) IN _moreorequaltofivelist, [count measure:],
        NOT HASONEVALUE ( product_dimension[product] ), [count measure:]
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you JIhwan, 

Only I think your solution is perhaps more complex than I need. For example my table as a list of products and that is all) I can group by in the transform data section when i upload the data, therefore i am left with 2 columns Product and Count. 

 

From here i just want to group any of those counted as less than 5 into 'Other' not sure i needed the table with product index etc 

 

I'm hoping there may be a simpler solution

moncx
Resolver II
Resolver II

Hey,

 

there is older post on this topic in this forum, have you tried the solution provided here: Solved: Create miscellaneous/other group using count below... - Microsoft Fabric Community

 

 

Hope it helps!

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.