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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Michael_Shown
New Member

How to do 'group by' in power BI report

Hi,

 

I'm new to Power BI.

I have a very simple data set as below and I want end user(s) to group any column(s) from a single table.

Group By functionality is available in power query editor but I'm wondering if there's any way of grouping rows by a column in power bi report publishsed to power bi service.

Any comment will be very appreiciated.

 Custom grouping in power BI.JPG

 

Thank you.

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Michael_Shown ,

 

Here are the steps you can follow:

1. Create measure.

Measure = 
    IF(
        ISINSCOPE('Table'[Item number]),
        
      MAX('Table'[Color])
        ,
        IF(
    ISINSCOPE('Table'[Color]),
      COUNTX(
            FILTER(ALL('Table'),'Table'[Color]=MAX('Table'[Color])),[Item number])
    ,
    COUNTX(ALL('Table'),'Table'[Color])))

2. Result:

vyangliumsft_0-1690350154015.png

Best Regards,

Liu Yang

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

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @Michael_Shown ,

 

Here are the steps you can follow:

1. Create measure.

Measure = 
    IF(
        ISINSCOPE('Table'[Item number]),
        
      MAX('Table'[Color])
        ,
        IF(
    ISINSCOPE('Table'[Color]),
      COUNTX(
            FILTER(ALL('Table'),'Table'[Color]=MAX('Table'[Color])),[Item number])
    ,
    COUNTX(ALL('Table'),'Table'[Color])))

2. Result:

vyangliumsft_0-1690350154015.png

Best Regards,

Liu Yang

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

AnkitKukreja
Super User
Super User

Hi @Michael_Shown 

 

Does this work for you?  If yes, just right click on your column from the table and use option create hierarchy.

 

AnkitKukreja_0-1690208864818.png

AnkitKukreja_1-1690208940431.png

 

 

attaching the pbix file for your reference.

 

 

If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.
Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors