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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

How to get list of people who are tagged to multiple categories

Hi everyone, I need a help with the following scenario. 
Data : 

EmployeeAvailability
AAllocated 
BAvailable
CAvailable
ALeave

 

SatishBadiger_0-1657521855790.png

Problem Statement: 
If you could see in the visual provided, the distinct count of employees that I have is 619. 
But if we refer to the pie chart there are (608+144+581 = 1333) employees. 
I want to get a list of employees who are tagged to multiple "Availability" category. For example in the dataset above "employee A" is tagged to both "Allocated" and "Leave" catgegories.   



Thanks in advance. 

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi  @Anonymous ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. Assume that there is one table with the similar structer as the table below in your model, you can create a calculated column as below to get the latest availablity for per employee:

yingyinr_0-1657778286123.png

Latest availability = 
VAR _maxdate =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( 'Table', 'Table'[Employee] = EARLIER ( 'Table'[Employee] ) )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[Availability] ),
        FILTER (
            'Table',
            'Table'[Employee] = EARLIER ( 'Table'[Employee] )
                && 'Table'[Date] = _maxdate
        )
    )

Then put the new calculated column onto the pie chart to replace the original field [Availability]:

yingyinr_1-1657778413443.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
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

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi  @Anonymous ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. Assume that there is one table with the similar structer as the table below in your model, you can create a calculated column as below to get the latest availablity for per employee:

yingyinr_0-1657778286123.png

Latest availability = 
VAR _maxdate =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( 'Table', 'Table'[Employee] = EARLIER ( 'Table'[Employee] ) )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[Availability] ),
        FILTER (
            'Table',
            'Table'[Employee] = EARLIER ( 'Table'[Employee] )
                && 'Table'[Date] = _maxdate
        )
    )

Then put the new calculated column onto the pie chart to replace the original field [Availability]:

yingyinr_1-1657778413443.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-yiruan-msft , first of all I would like to thank you. I really appreciate your time and efforts. I would like to understand this peice of code better. I want to know what exactly are you trying to do in the first half of the code i.e when you define the variable. Could you please try to explain that piece of code in plain english so that I can understand it properly. 
Thanks again. 

Hi @Anonymous ,

The following part of the code is to get the last work date of each employee.

yingyinr_0-1657871408838.png

And the following part of this code is to get the status of each employee on last work date.

yingyinr_1-1657871451711.png

yingyinr_3-1657872106339.png

In order to give you a solution that fits your scenario, you can provide some sample data inside your model(exclude sensitive data) and some examples to show your final desired result. Thank you.

Best Regards

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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