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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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