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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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

Anonymous
Not applicable

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
Anonymous
Not applicable

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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