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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
SBR1D
Helper II
Helper II

Get number of returning employers

Hi All

 

I have googled this issue but none of the results match my scenario fully so i thought i'd ask here.

 

I have the following dataset and I want to have a table of returning employers. For example in the dataset JD sports at the time of November 2023 had 0 learners but in December 2023 they had a new learner so they are now a returning employer.  I'm really struggling with the logic and if i need to expand on my Lost employer or New Employer measures.

 

Lost employer 

 

 

 

Lost employers = VAR  Lost =  CALCULATETABLE(SUMMARIZE(LearningPlan,LearningPlan[Employer name]),(LearningPlan[Status]="In Progress"))

                RETURN
                COUNTROWS(FILTER(SUMMARIZE(LearningPlan,LearningPlan[Employer name]),
                NOT LearningPlan[Employer name] IN Lost))

 

 

 

 

New employer 

 

 

 

New Employer = 
    VAR Current_Employer = CALCULATETABLE(SUMMARIZE(LearningPlan,LearningPlan[Employer name]), DATESBETWEEN(LearningPlan[Start Date], MIN(LearningPlan[Start Date]), EOMONTH(TODAY(), -1)))

    RETURN
    COUNTROWS(FILTER(SUMMARIZE(LearningPlan,LearningPlan[Employer name]),NOT LearningPlan[Employer name] IN Current_Employer))

 

 

 

 

Dataset 

 

LearnerIDLearnerNameStart DatePlanned EndStatusEmployerIDEmployer nameCompletion DateWithdrawal DateInclude in ILR?
1Bob J01-Mar-2019-Jun-21Withdrawn1JD Sports 04-Feb-20Yes
2Sidney D02-Apr-2021-Jul-21Withdrawn1JD Sports 13-Jan-21Yes
3Josh A01-Mar-2019-Jun-21Withdrawn1JD Sports 19-Jun-20Yes
4Christian R14-Mar-2002-Jul-21Withdrawn1JD Sports 17-Jul-20Yes
5Tommy H18-Mar-2106-Jul-22Withdrawn2Barrys Emporium 10-Jun-21Yes
6Bruce D19-Sep-2007-Jan-22Withdrawn2Barrys Emporium 11-Nov-20Yes
7James H16-Sep-2303-Jan-25Withdrawn2Barrys Emporium 19-Sep-23Yes
8Angus Y12-Dec-2001-Apr-22Withdrawn2Barrys Emporium 03-Mar-23Yes
9Marshall M03-Sep-1921-Dec-20Withdrawn3Target 10-Oct-20Yes
10Barry K15-Jun-2302-Oct-24Withdrawn3Target 08-Aug-23Yes
11Tony K30-Apr-1917-Aug-20Withdrawn3Target 29-May-19No
12Emily D11-Jan-2030-Apr-21Withdrawn3Target 02-Feb-20Yes
13Rebecca R08-Dec-2327-Mar-25Withdrawn4McDonalds 11-Apr-24Yes
14Jane S06-Feb-2326-May-24Withdrawn4McDonalds 07-Feb-23Yes
15Amy I17-Jan-2406-May-25Withdrawn4McDonalds 11-May-24Yes
16Erin S02-Feb-2322-May-24Withdrawn4McDonalds 11-Feb-23Yes
17Bertrina D01-Feb-2222-May-26Withdrawn5KFC 17-Feb-22Yes
18John D03-Jun-2221-Sep-23Withdrawn5KFC 04-Aug-22Yes
19Tim P03-Jul-2321-Oct-25Withdrawn5KFC 10-Jul-23No
20Maxine A11-Nov-2328-Feb-25Withdrawn5KFC 07-Dec-23Yes
21Jasmine P11-Nov-2324-Apr-24In Progress2Barrys Emporium  No
22Jack D30-Apr-1910-Dec-20In Progress5KFC  No
23Rob K01-Jan-1823-May-23In Progress3Target  No
24Jessy J15-Mar-1723-May-23In Progress3Target  No
25Chad M25-Apr-1728-Feb-24In Progress3Target  No
26Mo I29-Dec-2306-Mar-25In Proress10Burger King  Yes
27Jason N09-Jan-2406-Jun-25In Progress11Gillete  Yes
28Jenny J22-Dec-2309-Aug-25In Progress1JD Sports  Yes

 

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

Hello @SBR1D,

 

Can you please try this:

 

1. Employers with Current Learners

Current Employers = 
CALCULATE(
    DISTINCTCOUNT(LearningPlan[EmployerID]),
    LearningPlan[Status] = "In Progress"
)

2. Employers with Past Learners

Past Employers = 
CALCULATE(
    DISTINCTCOUNT(LearningPlan[EmployerID]),
    LearningPlan[Status] <> "In Progress"
)

3. Returning Employers

Returning Employers = 
CALCULATE(
    COUNTROWS(
        INTERSECT(
            VALUES(LearningPlan[EmployerID]),
            CALCULATETABLE(VALUES(LearningPlan[EmployerID]), LearningPlan[Status] <> "In Progress")
        )
    ),
    LearningPlan[Status] = "In Progress"
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hi, thanks for your answer but i don't think the returning employers measure is logically correct. 

A returning employer won't have 0 learners <> " In Progress" and  Learners "In Progress" at the same time. I think I need to get learners who had 0 learners <> " In Progress" x number of months before today and then employers with learners in progress from today-7 days  to the current day.

 

I have tried the following but it doesn't give correct result. Any ideas please?

 

lost emps calc = CALCULATE([Lost employers],DATESBETWEEN(LearningPlan[Withdrawal Date],EDATE(TODAY(),-3),TODAY()-7))

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.