Forum Discussion
distinct count with condition
It sounds like a job for CALCULATE
CALCULATE(DISTINCTCOUNT('Orders'[order_num]),'Orders'[source] IN { "google", "mail", "bing" })
depending on the structure of your report and what the external filter context is you may have to add an ALL('Orders')
Join the conversation on We Talk BI
More about me on Slow BI
Hi kentyler
Thanks for your answer.
The data model is:
- unique order number is in 1 table.
- Google Analytics order number table ("google_analytics_order_no") is combined with this unique order number (1 to *)
- ERP data ("sales") is combined with unique order number (1 to *). My formula looks like this:
- Anonymous6 years agoNot applicable
Hi clarissa ,
Try trouble shooting your DAX
Order PMKT = CALCULATE(DISTINCTCOUNT(sales[order_no]), FILTER(google_analytics_order_no, google_analytics_order_no[source_medium] = "google / cpc" )
See if the formula is returning the correct value for "google/cpc".Also, remove all trailing spaces by Trimming this column in Query Editor.
Regards,
Harsh Nathani
Appreciate with a Kudos!! (Click the Thumbs Up Button)
- clarissa6 years agoHelper I
Hi Harsh
Thank you for your feedback. Why do you think it is linked to the trailing spaces? I get numbers but the Google Analytics number is higher than the Sales Table Number, which doesn't make sense... Is the DAX Formula right or does it react differently if the distinctcount is applied on another table than the filter table?`
Thank you!
- Anonymous6 years agoNot applicable