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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

grouping orders

Hello  Community  -  

 

I have what I think is a simple question.    Using the calculated column formula below, my goal is to assign categories to Orders based on the total value of the order.    However, what is happening is that the formula is looking at the individual line of the order, rather than order value in total.     

 

For example, it is assigining (incorrectly), the category of "Quick Ship" to these lines below....because they are indeed below 40,000 dollars.   But actually the correct categorization of this should be "10 Day" because the value of the Order is above 40,000 and below 100,000.    

 

How can modify my formula to ensure it is taking the total sum of the Order  (based on Order ID)?

 

quick ship.png

 

Shipment Category = IF('Shipped'[Shipped Price] <= 40000,"Quick Ship",IF('Shipped'[Shipped Price] > 40000 && 'Shipped'[Shipped Price] < 100000,"10 Day",IF('Shipped'[Shipped Price] >= 100000,"30 Day")))
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You need to have order-level sum, inside this formula or as a new column.

 

example, both as new columns

order sum = sumx(filter('Shipped', [order no] = earlier([order no] )),[Shipped Price] )

 

Shipment Category =
switch( true(),
'Shipped'[order sum ] <= 40000,"Quick Ship",
'Shipped'[order sum ] < 100000,"10 Day",
"30 Day"
)

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , You need to have order-level sum, inside this formula or as a new column.

 

example, both as new columns

order sum = sumx(filter('Shipped', [order no] = earlier([order no] )),[Shipped Price] )

 

Shipment Category =
switch( true(),
'Shipped'[order sum ] <= 40000,"Quick Ship",
'Shipped'[order sum ] < 100000,"10 Day",
"30 Day"
)

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

Hi @Anonymous ,

 

Yes, the calculated column is by individual line, but not order.

 

If you want to sum it based on order id, you may try to use the below calculated measure:

 

Measure = calculate(sum(your_value),allexcept(your_table,order_id)).

 

Please try.

Aiolos Zhao

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.