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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Filtering a measure

Hi All,

 

I have a measure which calculates the 12 month rolling headcount from an employee file. Measure as below.

 

However, i need it to exclude certain "Contract Types" so i have a field called Contract Type, and i need it to count just Perm and Fix term and exclude Agency etc. How would i amend this measure to do that? Thanks in advance for any suggestions!

 

 

Rolling 12 month HC =
CALCULATE(
COUNT( 'HC'[Employee ID] ),
DATESINPERIOD( 'Date'[Date], MAX( 'Date'[Date] ), -12, MONTH ))
1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @Anonymous ,

 

You can try like this:-

Rolling 12 month HC =
CALCULATE (
    COUNT ( 'HC'[Employee ID] ),
    DATESINPERIOD ( 'Date'[Date], MAX ( 'Date'[Date] ), -12, MONTH ),
    FILTER (
        'table',
        table[Contract Type]
            IN { "Perm", "Fix" }
            && table[Contract Type] <> Agency
    )
)

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

It didnt work with the "&& table[contract type] <> Agency line

But has worked with just the IN line. Thank you!!

Samarth_18
Community Champion
Community Champion

Hi @Anonymous ,

 

You can try like this:-

Rolling 12 month HC =
CALCULATE (
    COUNT ( 'HC'[Employee ID] ),
    DATESINPERIOD ( 'Date'[Date], MAX ( 'Date'[Date] ), -12, MONTH ),
    FILTER (
        'table',
        table[Contract Type]
            IN { "Perm", "Fix" }
            && table[Contract Type] <> Agency
    )
)

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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