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
Anonymous
Not applicable

Sum some categories for the same date

dear all,

 

Please help me to solve a problem. I'm a beginner and I need to solve a problem. I attached a sampe data. I want to group all the fruits belonging to a certain date. The reason is tha I need to add in a graph, per day, the following cat.:

- fruits (apple + orange+ banana)

- PC

- car

- House 

 

can you please help me?

Screenshot 2024-02-22 155221.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

 

@amitchandak  GOOD ANSWER!

 

Here are my additions:

 

You can create a calculated column.

Type1 = SWITCH(TRUE(),
[Type] = "apple" || [Type] = "bannana" || [Type] = "orange", "fruits",
[Type] = "Bicycle", "Car",
[Type] = "house", "House",
[Type] = "PC", "PC")

 

And a measure.

Sum = CALCULATE(SUM('Table'[Cost]), ALLEXCEPT('Table', 'Table'[Type1], 'Table'[Date])) 

 

Or do the following:

vxuxinyimsft_0-1708660296322.png

 

Output:

vxuxinyimsft_1-1708660328775.png

 

vxuxinyimsft_2-1708660349090.png

Is this the result you expect?

 

Best Regards,
Yulia Xu

 

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

4 REPLIES 4
Anonymous
Not applicable

It seems to work. Thank you all.

It was also usefull the exemple!

Anonymous
Not applicable

Thank you Both. I will start to test it but it seems logical. I will come back if something is not clear for me.

Anonymous
Not applicable

Hi @Anonymous 

 

@amitchandak  GOOD ANSWER!

 

Here are my additions:

 

You can create a calculated column.

Type1 = SWITCH(TRUE(),
[Type] = "apple" || [Type] = "bannana" || [Type] = "orange", "fruits",
[Type] = "Bicycle", "Car",
[Type] = "house", "House",
[Type] = "PC", "PC")

 

And a measure.

Sum = CALCULATE(SUM('Table'[Cost]), ALLEXCEPT('Table', 'Table'[Type1], 'Table'[Date])) 

 

Or do the following:

vxuxinyimsft_0-1708660296322.png

 

Output:

vxuxinyimsft_1-1708660328775.png

 

vxuxinyimsft_2-1708660349090.png

Is this the result you expect?

 

Best Regards,
Yulia Xu

 

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

amitchandak
Super User
Super User

@Anonymous , You need to create a calculated column using Switch

 

Switch(True() ,

[Type] in {"apple","orange","banana"} , "fruits",

//add additional code

"Others"

)

 

 

Switch-Case statement of #PowerBI: https://www.youtube.com/watch?v=gelJWktlR80&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=56

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.