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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
zileng
Frequent Visitor

DAX Average Price Group By Value

Hello,

 

How do I group total orders by order numbers?

 

For total orders more than 200, name order number "> USD 200"

For total orders less than 200, name order number "< USD 200"

 

Order NumberProductQtyOrders
000001A110
000001B1030
000001C210
000001D560
000001E310
000002A455
000002B845
000002C530
000003A890
000003B60100
000003C630
000003D260
000003E420
000004A4200
000004B3060
000004C27

 

After grouping, I need to create another table to separate order number "> USD 200" and "< USD 200" with average price of each product.

 

Product< USD 200> USD 200
AAverage PriceAverage Price
BAverage PriceAverage Price
CAverage PriceAverage Price
DAverage PriceAverage Price
EAverage PriceAverage Price

 

1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

Hi @zileng ,

 

Create the following measure to get total orders by ORDER NUMBER:

totalOrdersbyOrderNum =
CALCULATE(SUM( OrderData[Orders]),
FILTER(ALL(OrderData),
SUMX(
FILTER((OrderData), EARLIER( OrderData[Order Number] ) = OrderData[Order Number] ), OrderData[Orders] )
)
)
 
Now created a calculated column to categorise these totals:
OrderGroup1 =
IF(
[totalOrdersbyOrderNum] > 200, "> USD 200", "< USD 200"
)
 
Now just to check the calculations, move the above calculations to a table visual:
p1.PNG
 
The calculations look right, so now create a matrix visualisation:
p2.PNG
 
I don't see a PRICE column in your data therefore have moved total QTY to VALUES section. But you can move Average price here.
 
Thanks,
Pragati
 
 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

2 REPLIES 2
Pragati11
Super User
Super User

Hi @zileng ,

 

Create the following measure to get total orders by ORDER NUMBER:

totalOrdersbyOrderNum =
CALCULATE(SUM( OrderData[Orders]),
FILTER(ALL(OrderData),
SUMX(
FILTER((OrderData), EARLIER( OrderData[Order Number] ) = OrderData[Order Number] ), OrderData[Orders] )
)
)
 
Now created a calculated column to categorise these totals:
OrderGroup1 =
IF(
[totalOrdersbyOrderNum] > 200, "> USD 200", "< USD 200"
)
 
Now just to check the calculations, move the above calculations to a table visual:
p1.PNG
 
The calculations look right, so now create a matrix visualisation:
p2.PNG
 
I don't see a PRICE column in your data therefore have moved total QTY to VALUES section. But you can move Average price here.
 
Thanks,
Pragati
 
 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

amitchandak
Super User
Super User

@zileng , I do not see any amount or price column, but the calculation would be like this

 

order < 200 = AverageX(filter(summarize(Table,Table[product], "_1", sum(Table[Qty])), [_1]< 200),[_1])

 

order >= 200 = AverageX(filter(summarize(Table,Table[product], "_1", sum(Table[Qty])), [_1]>= 200),[_1])

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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