cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
key_to
Advocate I
Advocate I

Showing number of employees from last month (dynamic)

Hello,

 

I am trying to show the number of employees in previous month. I came up with the following formula. I tested each variable separately. 

 

Var lastmonth works and gives me the number of previous month (If I filter for october it shows 9, if I filter for april it shows 3 etc)

Var _activelastmonth gives me the number of employees in current month if I skip the statement "&& 'Fact_Employee overview'[Date]=lastmonth". However when I include the statement, I get blank result. I wonder how I can make these two variables connect. 

'Fact_Employee overview'[Date] has a relationship to a date table to column DimDate[Date]

 

Currently my formula looks like this: 

 

Permanent employees previous month =
var lastmonth= MAX(DimDate[Month])-1
VAR _activelastmonth =
    SUMMARIZE (
        FILTER (
            'Fact_Employee overview',(
            'Fact_Employee overview'[Employee Class]="Permanent"
            &&
           Not(CONTAINSSTRING('Fact_Employee overview'[Company],"NBRE"))
           &&
            CONTAINSSTRING( 'Fact_Employee overview'[Business Unit],"NBIM")
             && OR('Fact_Employee overview'[Employee Status]="Active",CONTAINSSTRING('Fact_Employee overview'[Employee Status],"Leave"))
             && 'Fact_Employee overview'[Date]=lastmonth
            )
        ),
        'Fact_Employee overview'[SuccessFactor ID])
VAR result =
    COUNTROWS ( _activelastmonth )
RETURN
    result
 
Thankfull for any help! 
2 REPLIES 2
key_to
Advocate I
Advocate I

Hi! Unfortunately your message does not appear in english and I am not able to read it. 

v-xiaosun-msft
Community Support
Community Support

@key_to

 

Based on your description, your formula doesn't seem to be wrong. I think it may not apply to your specific data. Can you provide your data so that we can better assist you?

 

Best Regards,
Community Support Team _ xiaosun

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

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors