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
Billy_1979
Frequent Visitor

Grouping or distinct values

Hi I have a data set below.

 

i have a number of entries for 1 id number - what i am trying to do is if the id number as top 30 entry then group that as Top30 and don't group the rest, but if there is no Top 30 in the entry then count it as other.

 

At the moment as you can see below my query is bring back every that is not a Top 30 as other. so even if i count its by distinct by the id i will be double count the entry.

 

i hope that makes sense please find below a screen shot of the data. 

 

Thanks,

 

Billy_1979_0-1739183546663.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Billy_1979,

I think you should modify your M query as below:

if List.Contains([All Data][Sticker ID], "Top 30") then "Top30" else "Other"

I have made a simple test for your reference:

vqiaqimsftv_0-1739240425017.png

Please check the attached .pbix file for details.

 

Best Regards,
Qi
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

View solution in original post

5 REPLIES 5
Akash_Varuna
Super User
Super User

Hi @Billy_1979 , Could you please try these 

  • Group by ID: Go to Group By → Group by ID→ Select All Rows
  • Add Custom Column:
    if List.Contains(Table.Column([All Data], "Category"), "Top30") then "Top30" else "Other"
  • Expand Data: Expand grouped rows and use the new column for filtering or classification.
    Alternatively you could use sql to achive this with CASE clause 
    If this post helped please do give a kudos and accept this as a solution
    Thanks In Advance

Hi @Akash_Varuna 

 

So i have grouped the data 

Billy_1979_0-1739190681267.png

 

Then i created the custom column,

Billy_1979_2-1739190870934.png

 

 

When i do this im getting alot of duplicate entries.

 i think i may have missed a step or the logic i have put in is incorrect.

 

Thanks

 

 

Hi @Billy_1979 , Instead of category put your required column Sticker id or any other 
eg : if List.Contains([All Data][Sticker ID], "Top30") then "Top30" else "Other"

Anonymous
Not applicable

Hi @Billy_1979,

I think you should modify your M query as below:

if List.Contains([All Data][Sticker ID], "Top 30") then "Top30" else "Other"

I have made a simple test for your reference:

vqiaqimsftv_0-1739240425017.png

Please check the attached .pbix file for details.

 

Best Regards,
Qi
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

This Solution worked perfectly thanks for your help. @Anonymous 

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.

Top Solution Authors
Top Kudoed Authors