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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
WCONGRAVE
Advocate I
Advocate I

Group Orders by Quantity of Item ordered

HI

 

I have a Star Schema Model, with all of the data held in the fact table linked to dimension tables such as customer, calendar, product etc.

 

Now I have a requirement to report based upon how many items are in an order as per below

 

Items in OrderCount of OrdersTotal £
11000£10000
212000£260000
314000£450000
415000£666000
513000£845000

 

In my mind, to do this I'd need a Sales Header table with the count of lines in it per order to act as a DIM table. I could then join on the transaction ID and  produce the above report. But my fact table has tens of millions of rows, so calculating this table would take a long time, and the join would be really inefficient. Is there a better way of acheiving this same result in a DAX calculation?

 

 

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @WCONGRAVE ,

In order to provide you a suitable solution, could you please share some sample data in your model (exclude sensitive data) and your expected result with calculation logic and special examples? Thank you.

In addition, you can refer the following links to get it.

yingyinr_0-1641887971870.png

Customers Grouped by Count of Their Orders – Static Segmentation in Power BI

yingyinr_1-1641888204466.png

Best Regards

Community Support Team _ Rena
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

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @WCONGRAVE ,

Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yiruan-msft
Community Support
Community Support

Hi @WCONGRAVE ,

In order to provide you a suitable solution, could you please share some sample data in your model (exclude sensitive data) and your expected result with calculation logic and special examples? Thank you.

In addition, you can refer the following links to get it.

yingyinr_0-1641887971870.png

Customers Grouped by Count of Their Orders – Static Segmentation in Power BI

yingyinr_1-1641888204466.png

Best Regards

Community Support Team _ Rena
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

@WCONGRAVE , usually we merge and create single table for sales header and sales transactions

 

we can count distinct for sales header

 

or measure like

sumx(summarize(sales, sales[header id], sales[header amount]), [header amount] )

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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