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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Aweklin
New Member

How to group data on table

Hello,

 

How do I display Product Categories and Product Count Against each category in a tabular format?

 

Just like writing

 

SELECT c.Name AS Category, Count(p.ID) AS ProductCount

FROM Category c

INNER JOIN Product p ON c.ID = p.CategoryID

GROUP BY c.Name

 

And is it possible to even write SQL Queries in PowerBI? I use to do this in QlikView!

 

Thanks.

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Aweklin,

 

Perhaps you can try to use group function of power query.

 

Referecn link:

Group rows in a table (Power Query)

 

Regards,

Xiaoxin Sheng

View solution in original post

Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @Aweklin

 

If your datasource is an SQL datasource then you can just run this SQL as your query into your table and let the DB Engine do the grouping.  Otherwise you can do this both in the Query Editor and in DAX.

 

In DAX the forumla will look something like :

 

New Table = SUMMARIZE ( '<your table>' , [Name] , "ProductCount" , COUNTROWS('<your table>') )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @Aweklin

 

If your datasource is an SQL datasource then you can just run this SQL as your query into your table and let the DB Engine do the grouping.  Otherwise you can do this both in the Query Editor and in DAX.

 

In DAX the forumla will look something like :

 

New Table = SUMMARIZE ( '<your table>' , [Name] , "ProductCount" , COUNTROWS('<your table>') )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

Hi @Aweklin,

 

Perhaps you can try to use group function of power query.

 

Referecn link:

Group rows in a table (Power Query)

 

Regards,

Xiaoxin Sheng

bjnodello
Helper II
Helper II

You should be able to add Category and ID to a table visualization.  On the ID click the little down arrow and select "Count" (Values section of the table element on the right side menu).

 

I'm not familiar with QlikView.  You can use SQL to get your data into Power BI from a source that supports it, but DAX is used to create measures and calculated columns within the model.

 

Brett

 

 

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.