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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
selected_
Helper IV
Helper IV

How to calculate sum of a category ?

I have a column which look like this:

 

Category
new order
old order
cancelled order
pending

cancelled order

new order

new order

pending

new order

pending

 

What I want is that I want to make a measure total of each one in that category column.  

 

For example new order = 120

pending = 200

 

 

1 ACCEPTED SOLUTION

Hi @selected_ ,

 

Please create a measure like this.

Measure = COUNT(Sheet5[Category])

v-lionel-msft_0-1600656322027.png

 

Best regards,
Lionel Chen

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

5 REPLIES 5
amitchandak
Super User
Super User

@selected_ , A measure like

Sumx(Table, Switch( True() , [Category] = "new order" ,120 , [Category]="pending ",200,0))

 

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

 

I don't have the values of each one in that category that's why I wanna calucate a measure count on how many "new order" or "pending" are in that category.

@selected_ ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak

The column in my dataset look like this, new order and pending with more than one records

Category
new order
new order
new order
new order
new order
new order
pending order
pending order
pending order

What I for output it gonna count amount new order and pending in each column order in to a new table like this

CategoryTotal
new order6
pending order3

Hi @selected_ ,

 

Please create a measure like this.

Measure = COUNT(Sheet5[Category])

v-lionel-msft_0-1600656322027.png

 

Best regards,
Lionel Chen

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

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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