topic Counting highest number of employees on the same date (distinct count problem) in Desktop
https://community.powerbi.com/t5/Desktop/Counting-highest-number-of-employees-on-the-same-date-distinct/m-p/1806871#M703571
<P>Hi!</P><P> </P><P>Looking for help creating a measure to calculate the highest number of employees at the same time.</P><P>My data consists of a table of with employees and information connected to the employee. There is a line for each date for each employee. This is in order to track different employment data regarding employees over time.</P><P>I need to calculate the highest number of employees employed at any given date in a time period (year, quarter, month etc.) – <STRONG>at the same time</STRONG>!</P><P>I’m trying to use a simple distinct count function on the employee ID, but that counts the total unique employee ID’s in my table and doesn’t take into consideration that employee ID has to be present on the same date.</P><P>Also tried using the formula below but it doesn’t work either.</P><P>CALCULATE ( DISTINCTCOUNTNOBLANK ('Table'[EMP_KEY]) , GROUPBY (DATES , DATES[DATE] ) )</P><P> </P><P>Example of data:</P><P> </P><P>Date EMP_KEY Distinct count per date (not in table)</P><P>01-01-2021 1 </P><P>01-01-2021 2 </P><P>01-01-2021 3 3 (01-01-2021)</P><P>02-01-2021 3 </P><P>02-01-2021 4</P><P>02-01-2021 5</P><P>02-01-2021 6</P><P>02-01-2021 7</P><P>02-01-2021 8 6 (02-01-2021)</P><P>03-01-2021 9</P><P>03-01-2021 10 2 (03-01-2021)</P><P> </P><P>The result I’m looking for in above example is 6 employees (since the highest distinct count is 6 on 02-01-2021), but in my report the result I get is 10 (since there are 10 distinct EMP_KEY’s in the table).</P><P> </P><P>Any help is appreciated.</P><P> </P><P> </P>Mon, 26 Apr 2021 19:01:42 GMTdnimand2021-04-26T19:01:42ZCounting highest number of employees on the same date (distinct count problem)
https://community.powerbi.com/t5/Desktop/Counting-highest-number-of-employees-on-the-same-date-distinct/m-p/1806871#M703571
<P>Hi!</P><P> </P><P>Looking for help creating a measure to calculate the highest number of employees at the same time.</P><P>My data consists of a table of with employees and information connected to the employee. There is a line for each date for each employee. This is in order to track different employment data regarding employees over time.</P><P>I need to calculate the highest number of employees employed at any given date in a time period (year, quarter, month etc.) – <STRONG>at the same time</STRONG>!</P><P>I’m trying to use a simple distinct count function on the employee ID, but that counts the total unique employee ID’s in my table and doesn’t take into consideration that employee ID has to be present on the same date.</P><P>Also tried using the formula below but it doesn’t work either.</P><P>CALCULATE ( DISTINCTCOUNTNOBLANK ('Table'[EMP_KEY]) , GROUPBY (DATES , DATES[DATE] ) )</P><P> </P><P>Example of data:</P><P> </P><P>Date EMP_KEY Distinct count per date (not in table)</P><P>01-01-2021 1 </P><P>01-01-2021 2 </P><P>01-01-2021 3 3 (01-01-2021)</P><P>02-01-2021 3 </P><P>02-01-2021 4</P><P>02-01-2021 5</P><P>02-01-2021 6</P><P>02-01-2021 7</P><P>02-01-2021 8 6 (02-01-2021)</P><P>03-01-2021 9</P><P>03-01-2021 10 2 (03-01-2021)</P><P> </P><P>The result I’m looking for in above example is 6 employees (since the highest distinct count is 6 on 02-01-2021), but in my report the result I get is 10 (since there are 10 distinct EMP_KEY’s in the table).</P><P> </P><P>Any help is appreciated.</P><P> </P><P> </P>Mon, 26 Apr 2021 19:01:42 GMThttps://community.powerbi.com/t5/Desktop/Counting-highest-number-of-employees-on-the-same-date-distinct/m-p/1806871#M703571dnimand2021-04-26T19:01:42ZRe: Counting highest number of employees on the same date (distinct count problem)
https://community.powerbi.com/t5/Desktop/Counting-highest-number-of-employees-on-the-same-date-distinct/m-p/1806906#M703579
<P>Hi</P><P>This could be solved in a few ways but I think the simplest is to use the MAXX function, this will loop over all dates in your selection and calculate the unique number of employees per date then return the highest value.</P><P> </P><DIV><STRONG>Max Number of employees =</STRONG><BR /><STRONG><SPAN class="Keyword">MAXX</SPAN><SPAN class="Parenthesis"> (</SPAN></STRONG><BR /><STRONG><SPAN class="indent4"> </SPAN><SPAN class="Keyword">VALUES</SPAN><SPAN class="Parenthesis"> (</SPAN> 'Emp'[Date] <SPAN class="Parenthesis">)</SPAN>,</STRONG><BR /><STRONG><SPAN class="indent4"> </SPAN><SPAN class="Keyword">CALCULATE</SPAN><SPAN class="Parenthesis"> (</SPAN></STRONG><BR /><STRONG><SPAN class="indent8"> </SPAN><SPAN class="Keyword">DISTINCTCOUNT</SPAN><SPAN class="Parenthesis"> (</SPAN> 'Emp'[EMP_KEY] <SPAN class="Parenthesis">)</SPAN></STRONG><BR /><STRONG><SPAN class="indent4"> </SPAN><SPAN class="Parenthesis">)</SPAN></STRONG><BR /><STRONG><SPAN class="Parenthesis">)</SPAN></STRONG></DIV>Mon, 26 Apr 2021 19:28:06 GMThttps://community.powerbi.com/t5/Desktop/Counting-highest-number-of-employees-on-the-same-date-distinct/m-p/1806906#M703579MikeJohnsonZA2021-04-26T19:28:06ZRe: Counting highest number of employees on the same date (distinct count problem)
https://community.powerbi.com/t5/Desktop/Counting-highest-number-of-employees-on-the-same-date-distinct/m-p/1806938#M703587
<P>THANK YOU! Have been searching all day for a solution.</P>Mon, 26 Apr 2021 19:39:55 GMThttps://community.powerbi.com/t5/Desktop/Counting-highest-number-of-employees-on-the-same-date-distinct/m-p/1806938#M703587dnimand2021-04-26T19:39:55Z