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
Powerful
Frequent Visitor

Released and Joined Employees count

Hi,

I'm new to PowerBI DAX. I have connected data source to a folder where list of employees data dump is placed on regular basis (not daily).  Table name called Emp Data, columns are Data Dump Date, Emp ID, Emp Name and so on. I have created calendar table already in data model.

After appending different data files from folder it looks like as below:

 

Data Dump DateEmp IDEmp NameProject Code
3/14/202212345RameshABC123
3/14/202254321SureshXYZ123
3/14/202211223MaheshABC123
3/14/202212342GaneshXYZ123
3/14/202290876KailashABC123
3/14/202284782PawanABC123
3/14/202224729GirishXYZ123

3/17/2022

12345RameshABC123
3/17/202254321SureshXYZ123
3/17/202211223MaheshABC123
3/17/202212342GaneshXYZ123
3/17/202290876KailashABC123
3/17/202223432TinuABC123
3/17/202263325MinuXYZ123
3/17/202225266RituABC123

I'm trying to create a measure to find out count of employees released and joined in the next date.

Result should look like this:

3/14/2022ReleasedJoined3/17/2022
7238

Released: 2 as Emp ID 84782, 24729 are missing in the next date.

similarly Joined: 3 as Emp ID 23432,63325,25266 were not there in the previous date.

 

Appreciate any help in this.

Thanks.

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Powerful 

 

You can try the following methods.

Measure:

Count1 = 
CALCULATE (
    COUNT ( 'Table'[Emp ID] ),
    FILTER (
        ALL ( 'Table' ),
        [Emp ID] = SELECTEDVALUE ( 'Table'[Emp ID] )
            && [Data Dump Date] <= SELECTEDVALUE ( 'Table'[Data Dump Date] )
    )
)
Count2 = 
CALCULATE (
    COUNT ( 'Table'[Emp ID] ),
    FILTER (
        ALL ( 'Table' ),
        [Emp ID] = SELECTEDVALUE ( 'Table'[Emp ID] )
            && [Data Dump Date] >= SELECTEDVALUE ( 'Table'[Data Dump Date] )
    )
)
Joined = 
CALCULATE (
    COUNT ( 'Table'[Emp ID] ),
    FILTER (
        ALL ( 'Table' ),
        [Data Dump Date] = MAX ( 'Table'[Data Dump Date] )
            && [Count1] = 1
    )
)
Released = 
CALCULATE (
    COUNT ( 'Table'[Emp ID] ),
    FILTER (
        ALL ( 'Table' ),
        [Data Dump Date] = MIN ( 'Table'[Data Dump Date] )
            && [Count2] = 1
    )
)

vzhangti_0-1651216043757.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

5 REPLIES 5
v-zhangti
Community Support
Community Support

Hi, @Powerful 

 

You can try the following methods.

Measure:

Count1 = 
CALCULATE (
    COUNT ( 'Table'[Emp ID] ),
    FILTER (
        ALL ( 'Table' ),
        [Emp ID] = SELECTEDVALUE ( 'Table'[Emp ID] )
            && [Data Dump Date] <= SELECTEDVALUE ( 'Table'[Data Dump Date] )
    )
)
Count2 = 
CALCULATE (
    COUNT ( 'Table'[Emp ID] ),
    FILTER (
        ALL ( 'Table' ),
        [Emp ID] = SELECTEDVALUE ( 'Table'[Emp ID] )
            && [Data Dump Date] >= SELECTEDVALUE ( 'Table'[Data Dump Date] )
    )
)
Joined = 
CALCULATE (
    COUNT ( 'Table'[Emp ID] ),
    FILTER (
        ALL ( 'Table' ),
        [Data Dump Date] = MAX ( 'Table'[Data Dump Date] )
            && [Count1] = 1
    )
)
Released = 
CALCULATE (
    COUNT ( 'Table'[Emp ID] ),
    FILTER (
        ALL ( 'Table' ),
        [Data Dump Date] = MIN ( 'Table'[Data Dump Date] )
            && [Count2] = 1
    )
)

vzhangti_0-1651216043757.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Hi @v-zhangti,

Thanks this is working fine.

 

I have more than 2 dates in my data.

I have put date slicer also. I'm trying to do this for only 2 dates as you have done, those 2 dates should come from slicer MIN and MAX. I trying to modify the measures to get the results for more than 2 dates but unable to do it. Please help me..

Appreciate your support!!

Thanks a lot @v-zhangti 

This I was looking for, it is working.

 

PhilipTreacy
Super User
Super User

Hi @Powerful 

 

There isn't enough information to help you.  Please read this

 

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/td-p/1447523/jump...

 

Can you please supply some sample data and an example of the result(s) you are looking for.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thanks Phil,

I added few more details with sample data.

Please help!

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.