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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Gangasaniravi
Helper I
Helper I

Joiners and leavers based on salary

Hello,

want to calculate joiners and leavers based on salary , please find sample data.

 

IdMonth-YearSalaryHeadcount
83Jan-211001
83Feb-212001
83Mar-213001
83Apr-214001
83May-215001
83Jun-216001
83Jul-217001
83Aug-21 1
83Sep-21 1
83Oct-21 1
83Nov-21 1
83Dec-21 1
83Jan-22 1
83Feb-22 1
83Mar-22 1
83Apr-22 1
83May-22 1
83Jun-22 1
84Jan-21 1
84Feb-21 1
84Mar-21 1
84Apr-21 1
84May-21 1
84Jun-21 1
84Jul-21 1
84Aug-212501
84Sep-213401
84Oct-215001
84Nov-217001
84Dec-21 1
84Jan-22 1
84Feb-22 1
84Mar-22 1
84Apr-22 1
84May-22 1
84Jun-22 1
85Jan-21 1
85Feb-21 1
85Mar-21 1
85Apr-21 1
85May-21 1
85Jun-21 1
85Jul-21 1
85Aug-218001
85Sep-212001
85Oct-212001
85Nov-214501
85Dec-21 1
85Jan-22 1
85Feb-22 1
85Mar-22 1
85Apr-22 1
85May-22 1
85Jun-22 1
86Jan-21 1
86Feb-21 1
86Mar-21 1
86Apr-21 1
86May-21 1
86Jun-21 1
86Jul-21 1
86Aug-21 1
86Sep-21 1
86Oct-21 1
86Nov-21 1
86Dec-211001
86Jan-222001
86Feb-223001
86Mar-224001
86Apr-225001
86May-226001
86Jun-227001
87Jan-21 1
87Feb-21 1
87Mar-21 1
87Apr-218001
87May-212001
87Jun-212001
87Jul-21 1
87Aug-21 1
87Sep-21 1
87Oct-21 1
87Nov-21 1
87Dec-21 1
87Jan-22 1
87Feb-22 1
87Mar-22 1
87Apr-22 1
87May-22 1
87Jun-22 1
88Jan-21 1
88Feb-21 1
88Mar-213001
88Apr-214001
88May-215001
88Jun-216001
88Jul-217001
88Aug-21 1
88Sep-21 1
88Oct-21 1
88Nov-21 1
88Dec-21 1
88Jan-22 1
88Feb-22 1
88Mar-22 1
88Apr-22 1
88May-22 1
88Jun-22 1

 Logic for joiners: 

IF(AND([Current_Month]<>0,[Previous_Month]=0),sum([Headcount]))
Logic for Leavers: 

  IF(AND([Previous_Month]<>0,[Current_Month]=0),sum([Headcount]))

 

we need to use headcount from data not to hardcode it as 1, Not able to get data for leavers.

output:

Month-YearHeadcountsalaryJoinersLeaver
01 January 2021110000
01 February 2021120000
01 March 2021260010
01 April 20213160010
01 May 20213120000
01 June 20213140000
01 July 20212140001
01 August 20212105000
01 September 2021254000
01 October 2021270000
01 November 20212115000
01 December 2021110001
01 January 2022120000
01 February 2022130000
01 March 2022140000
01 April 2022150000
01 May 2022160000
01 June 2022170000
5 REPLIES 5
Gangasaniravi
Helper I
Helper I

Thanks @ryan_mayu for looking into this i am using direct query and have relation between fact table and date dimension based on date column. above solution is correct but not working with DQ

i seldom use DQ mode, let's see if anyone else can help you





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




ryan_mayu
Super User
Super User

@Gangasaniravi 

the first row is for 2021 Jan and the salary is 100, why the joiners for that month is 0?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu fir Jan 2021 headcount is 1 , there is no prrior moth to compare to start

joiners and lever is 0

@Gangasaniravi 

pls see the attachment below 

the output is sightly different from you expected.

 

e.g. 2021 aug should have 2 joiners, but what you expected is 0

11.PNG

 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.