Forum Discussion
ssbagley
3 years agoHelper III
Distinct Count (Direct Query) - Why is this so hard!?
Hi - me again. Source data is employee expense submissions in a SQL table via Direct Query. I want to count the number of expense reports by employee for a given date range (slicer). I've tried:
= Countrows(Summarize(Expenses, Expenses[ReportNumber]) )
= DISTINCTCOUNT (Expenses[ReportNumber] )
= COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER(Expenses,Expenses[ReportNumber]<>0),"Reports",Expenses[ReportNumber])))
I know this has to be possible -- what am I doing wrong??
7 Replies
- PVO3Impactful Individual
COUNTROWS(ALL('Table'[Primairy key])) is working fine for me
- ssbagleyHelper III
This displayed the same value for every employee which is not correct, but it did return a result which is an improvement from my previous attempts!
- PVO3Impactful Individual
Im sorry. Instead of primairy key i meant your name column. But im afraid this operation over this column has performance issues