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
ronald0
Frequent Visitor

Total order count of the customer who buy a brand at least one time

Hi,

 

I need to  get the total order of the customers who buy a brand at least one time.

Es :

I have table with BRAND, and for each brand the CustomerID who buy that brand,

i want the sum of the total orders made the customer who buy a brand, the Total Customers Orders

 

ronald0_1-1720787096556.png

 

i try with : 

 

total customer order = CALCULATE(SUMX(SUMMARIZE(Sales,Sales[KeyOrdine]),1),Sales[FlagAnnullato]=0,ALL(Dim_Brand[Brand]))
 
but in the aggregate sum it doesn't work.
 
Thanks

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ronald0 ,

Please create another new measure as below and put it on the visual to replace the original measure [Total Customer Order]:

 

New Measure = SUMX ( VALUES ( Dim_Brand[Brand] ), [Total Customer Order] )

 

In addition, you can refer the following links to try to solve your problem...

Why Your Total Is Incorrect In Power BI - The Key DAX Concept To Understand

Dax for Power BI: Fixing Incorrect Measure Totals

 

If the above ones can't help you figure out, it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

6 REPLIES 6
ronald0
Frequent Visitor

This is the sample sales fact table : 

 

ronald0_0-1721038563382.png

 

This the result i want :

 

ronald0_1-1721038596787.png

 

I want to calculate the Total Customers Orders , the total count of all orders by customers, who buy that brand ( in the filter context) at least one time. Not the total orders by the customer for only that brand ( column Orders)

I write this measure : but  it's wrong in the grand total, correct for single idfidelity. ( due to the ALL function)

 

CALCULATE(SUMX(SUMMARIZE(Sales,Sales[OrdersKey]),1),ALL(Dim_Brand[Brand])

 

can anyone help? Thanks,

 

Anonymous
Not applicable

Hi @ronald0 ,

Please create another new measure as below and put it on the visual to replace the original measure [Total Customer Order]:

 

New Measure = SUMX ( VALUES ( Dim_Brand[Brand] ), [Total Customer Order] )

 

In addition, you can refer the following links to try to solve your problem...

Why Your Total Is Incorrect In Power BI - The Key DAX Concept To Understand

Dax for Power BI: Fixing Incorrect Measure Totals

 

If the above ones can't help you figure out, it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

ronald0
Frequent Visitor

I have the sales fact table like this : 

 

IdCustomerOrderKeyProductproduct codeBrand
002512256product_xs14545brand1
002512256product_ys14546brand2
002613254product_zs14541brand3
002713242product_ys14546brand2
002515529product_xs14545brand1
002515529product_hs14549brand4
002515529product_ys14546brand2
002717546product_hs14549brand4
002717546product_gs14544brand5
002512250product_xs14545brand1
002712349product_ys14546brand2
002512506product_zs14541brand3

 

The result i want is  : Total Customer Order , the total count of all order by customer , who buy that brand at least one time, not the total order only for that brand ( the column Orders)

Customer by brandOrdersTotal Customer OrdersResult i have Now
brand1348
  0025344
brand2478
  0025244
  0027233
brand3258
  0025144
  0026111
brand4278
  0025144
  0027133
brand5138
  0027133
Total Order 888

 

the measure ihave now is ( wrong in the total )  : 

 

Measure = CALCULATE(SUMX(SUMMARIZE(Sales,Sales[OrderKey ]),1),ALL(Dim_Brand[Brand]))
 
can anyone help?
Thanks
ronald0
Frequent Visitor

Thanks for the support.

Yes, the problem is the total sum of the measure is wrong.

 

i have a sales fact table and the brand table.

Now i have the numbers of the total customer who buy that Brand,

 

Customer  =  CALCULATE(SUMX ( SUMMARIZE ( Sales, Sales[IdFidelity] ), 1) )

 
and the number of the orders of that Brand
 
Orders = CALCULATE(SUMX(SUMMARIZE(Sales,Sales[KeyOrder]),1))
 
Now, i want calculate the number of Total orders made by the customers who buy that brand.
 
BRANDCustomersOrdersTotal Customer Orders 
Adidas200100150

 

Mean, now i know that 200 customers buy adidas , with 100 order, but i want to know , that 200 customers how many orders made in total ? ( not only Adidas).

 

I have this number for each customer, but the total sum of the measure is wrong.

ronald0_0-1720792927765.png

 

 the total sum of the measure 'total customer order' it would be 95 in this example. 696049 is the sum of all the orders. 

 

Greg_Deckler
Community Champion
Community Champion

@ronald0 First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8

 

To get more specific, I agree with @BeaBF , sample data always expedites a solution.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
BeaBF
Super User
Super User

@ronald0 Hi! Can you paste some sample data?and explain better the desidered output?

 

BBF

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.