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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.