Average monthwse distinct count

sadath

Active Member
Joined
Oct 10, 2004
Messages
263
Office Version
  1. 365
Platform
  1. Windows
Hi
i have using this DAX to get count of employees

CountStew16:=(calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1)

this is not giving desired result bcoz some 'Empl Code' will be available in Jan only, some will be in Feb..... so on.

the below DAX is giving me correct result. but is there any simpler way??

CountStew16:=(
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=1)+
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=2)+
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=3)+
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=4)+
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=5)+
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=6)+
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=7)+
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=8)+
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=9)+
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=10)+
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=11)+
calculate(DISTINCTCOUNT('2016Stew'[Empl Code]),'2016Stew'[Days Worked]>=1,'2016Stew'[MONTH]=12)+
)/[CountM]
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi sadath,

Your best bet would be to use AVERAGEX to iterate over months and average the distinct count in each month.

Something like this:
Code:
CountStew16 :=
    AVERAGEX (
        VALUES ( '2016Stew'[MONTH] ),
        CALCULATE (
            DISTINCTCOUNT ( '2016Stew'[Empl Code] ),
            '2016Stew'[Days Worked] >= 1
        )
    )

Does this give the same result?
 
Upvote 0

Forum statistics

Threads
1,217,402
Messages
6,136,413
Members
450,010
Latest member
Doritto305

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top