Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
_Junayetrahman
Frequent Visitor

Monthly Employee Presence

Hi If you see the screenshot I I filter one month from slicer and one employee from slicer it is showing 2 which is wrong. It should show one. Because the employee was present in that month. If I select 1 and 2 month from slicer it is showing 5 but it should show 2 for that particular since Alex is present in month 1 and month 2. If selected month is 1,2 and 3 then total count should show 3. the employee is present in all the 3 months.  I need help on this how I can achieve using DAX. Thanks in advance. Total should be 1Total should be 1Total should be 2. If select 3 then it should show 3 sincr that employee is present in the month 1,2 and 3Total should be 2. If select 3 then it should show 3 sincr that employee is present in the month 1,2 and 3This is the dataThis is the dataequirement.

2 ACCEPTED SOLUTIONS
OguzMavice
Resolver II
Resolver II

Hi @_Junayetrahman , The data has denormalized architecture. In order to reach your target I can suggest 2 steps of Dax.

 

First step is creating calculated column which will be composite key for this dataset, meanly it is a primary key. 

superkey= combinevalues(",",[EmployeeName],[Month])  --> this one become a PK for your dataset. 

normally I prefer to create superkey by integer data types , but I saw your month and employeeName columns are both string. without converting datatype, you can directly create this composite key.

Then as a 2. step; 

create measure :

month_availability= distinctcount(superkey)

if you user this "month_availability" measure in your graph, it will work. 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

v-xiandat-msft
Community Support
Community Support

Hi @_Junayetrahman ,

Below is my table:

vxiandatmsft_0-1701328714917.png

The following DAX might work for you:

Measure = 
   CALCULATE(
     DISTINCTCOUNT('Table'[payroll Period]),
     ALLEXCEPT('Table','Table'[Month])
   )

The final output is shown in the following figure:

vxiandatmsft_1-1701328760183.png

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-xiandat-msft
Community Support
Community Support

Hi @_Junayetrahman ,

Below is my table:

vxiandatmsft_0-1701328714917.png

The following DAX might work for you:

Measure = 
   CALCULATE(
     DISTINCTCOUNT('Table'[payroll Period]),
     ALLEXCEPT('Table','Table'[Month])
   )

The final output is shown in the following figure:

vxiandatmsft_1-1701328760183.png

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

OguzMavice
Resolver II
Resolver II

Hi @_Junayetrahman , The data has denormalized architecture. In order to reach your target I can suggest 2 steps of Dax.

 

First step is creating calculated column which will be composite key for this dataset, meanly it is a primary key. 

superkey= combinevalues(",",[EmployeeName],[Month])  --> this one become a PK for your dataset. 

normally I prefer to create superkey by integer data types , but I saw your month and employeeName columns are both string. without converting datatype, you can directly create this composite key.

Then as a 2. step; 

create measure :

month_availability= distinctcount(superkey)

if you user this "month_availability" measure in your graph, it will work. 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors