Forum Discussion
DAX Distinct Count of Count Rows Calculation
Hey All,
Having an issue when viewing qualified personnel. Some people have zero, they are indicated in a column as "No License", However when someone has a qualification, and for each of those qualifications, the same column will indicate "License". The issue I have when creating a measure, it counts all the times "License" is there, not simply the one time, so I can't give the answer to "How many people do we have with a license"
COMPANY LAST NAME LICENSE QUALIFICATION
A Garth License Truck
A Garth License Van
B Vander License Truck
C Anders No License
D Dunn License Truck
D Clark License Truck
D Clark License Van
So when I do the Table using the Companies, and how many licensed personnel they have it should display
A 1
B 1
C 0
D 2
Any help is appreciated, I'm not sure how to use Distinct Count and Count Rows together, and using Filter doesn't seem to help either.
Hi TimsLanding ,
You can try using the below DAX
Create a Calculated Measure as shown below
NoofLicenses = VAR Licenses = CALCULATE(DISTINCTCOUNT(Table1[Last Name]), Table1[License] = "License") RETURN IF(ISBLANK(Licenses), 0, Licenses)The Output looks as follows
Regards,
2 Replies
- ThejeswarSuper User
Hi TimsLanding ,
You can try using the below DAX
Create a Calculated Measure as shown below
NoofLicenses = VAR Licenses = CALCULATE(DISTINCTCOUNT(Table1[Last Name]), Table1[License] = "License") RETURN IF(ISBLANK(Licenses), 0, Licenses)The Output looks as follows
Regards,
- TimsLandingFrequent Visitor
Thanks so much! I kept thinking I needed to use the Company in the equation, your equation works great!