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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

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 2. If select 3 then it should show 3 sincr that employee is present in the month 1,2 and 3This is the dataequirement.

2 ACCEPTED SOLUTIONS
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.

Community Support

Below is my table:

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:

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.

2 REPLIES 2
Community Support

Below is my table:

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:

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.

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 Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors