Forum Discussion
Sumifs equivalent Dax not working
Hi Everyone,
I keep getting errors on my Dax and nothing seems to work so I was wondering if someone has come across something similar.
I have a table with all the orders and customer Id's and I am trying to sum the number of orders each customer has by customer ID. Some of the orders are duplicated on the table so I am trying a distinct count. Also, there are orders that have zero value there which I need to exclude as they are exchanges
i initially tried
Any idea on what can I do to fix this?
Thank you in advance 🙂
12 Replies
- Jos_Woolley
Solution Sage
Hi,
Wouldn't this make more sense as a measure, instead of a calculated column?
Measure:Unique Orders = CALCULATE ( DISTINCTCOUNT ( 'custom table'[order name] ), 'custom table'[value] > 0 )Or, calculated column:
Unique_Orders = CALCULATE ( DISTINCTCOUNT ( 'custom table'[order name] ), FILTER ( 'custom table', 'custom table'[customer email] = EARLIER ( 'custom table'[customer email] ) && 'custom table'[value] > 0 ) )Regards
- AnonymousNot applicable
Hi Jos_Woolley ,
The measure wouldnt work in my case as i want after that calculation i want to sum the number of users that had 10 purchases in their records,14,15,16,17 etc.
I tried the calculated column but the syntax seems to get stick working on it for more than 30 min.
- Jos_Woolley
Solution Sage
How many rows' worth of data are we talking about?
Based on what you've said, it might be preferable to do this in Power Query.
Regards
- AnonymousNot applicable
- aj1973
Community Champion
Hi Anonymous
Power Query won't solve the issue as it shouldn't be used to do Calculations. Your formulas( column = IF...) are not correct. Can you share a Sample of your model? it's better and faster to help you with your issue
- AnonymousNot applicable
Hi,
I have attached below an excel example of my data and what they look like.
 
what i want to get frm this calculation that I am trying to do is to be able to get a bar chart showing number of customers that has 5 purchases on theirs records,6,7,10,20 etc.in order to be able to see how many purchases do returning customers tend to have.
- Ashish_Mathur
Super User
Hi,
Share some data and show the expected result.
- AnonymousNot applicable
Hi,
I have attached below an excel example of my data and what they look like.
 
what i want to get frm this calculation that I am trying to do is to be able to get a bar chart showing number of customers that has 5 purchases on theirs records,6,7,10,20 etc.in order to be able to see how many purchases do returning customers tend to have.
- Ashish_Mathur
Super User
Hi,
Share the download link of your PBI file and for a sample sample show the expected result.