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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Caesarul
Helper II
Helper II

Headcount Totals in Matrix

Hi, 

 

I have an issue that may be easier than I think (overthink that is). 

 

I have a Matrix that shows the headcount of each country/region per month (it has a slicer in which you can select the interval as well)

 

The summary data columns look like this: 

 

Month / Country / Active Headcount / Department

01/01/2022 / Australia / 3 / HR

01/01/2022 / Australia / 18 / Ops

01/01/2022 / Australia / 10 / IT

01/01/2022 / Australia / 9 / Finance

02/01/2022 / Australia / 6 / HR

02/01/2022 / Australia / 7 / Ops

02/01/2022 / Australia / 10 / IT

02/01/2022 / Australia / 18 / Finance

 

In the Matrix is shows well, until the Totals... as I have SUM of Active Headcount. 

 

Caesarul_0-1670493114947.png

 

Made a measure with Current Headcount which calculates the headcount on the last month only which shows accurate when placed in the Matrix with totals and everything, but it's obvious cause it's only summing up the last month. 

 

Caesarul_1-1670493344855.png

 

I'm sure this was solved before in one way or another, but couldn't find the thread. Any ideas how I can get the accurate Totals in the Matrix? 

 

Thank you very much for all your support and understanding, 

Caesar

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Caesarul ,

 

According to your statement, [Current Headcount] is a measure which will calculate the sum of headcount in last month. In your matrix, I can see three hierarchy levels Region/Country/Month. I think the result in your second screenshot should be correct. Do you want to customize the sum in other hierarchy levels? I suggest you to try 

ISINSCOPE() in your measure.
 
Measure =
IF (
    ISINSCOPE ( 'TableName'[Month] ),
    [Current Headcount],
    IF (
        ISINSCOPE ( 'TableName'[Country] ),
        CALCULATE ( SUM ( 'TableName'[Active Headcount] ),
        IF (
            ISINSCOPE ( 'TableName'[Region] ),
            CALCULATE ( SUM ( 'TableName'[Active Headcount] )
        )
    )
)
 

Best Regards,
Rico Zhou

 

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Caesarul , for last month join with date table, use date table columns in visual and slicer

 

and create measure like slicer

 

last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

 

Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

Power BI โ€” Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @Caesarul ,

 

According to your statement, [Current Headcount] is a measure which will calculate the sum of headcount in last month. In your matrix, I can see three hierarchy levels Region/Country/Month. I think the result in your second screenshot should be correct. Do you want to customize the sum in other hierarchy levels? I suggest you to try 

ISINSCOPE() in your measure.
 
Measure =
IF (
    ISINSCOPE ( 'TableName'[Month] ),
    [Current Headcount],
    IF (
        ISINSCOPE ( 'TableName'[Country] ),
        CALCULATE ( SUM ( 'TableName'[Active Headcount] ),
        IF (
            ISINSCOPE ( 'TableName'[Region] ),
            CALCULATE ( SUM ( 'TableName'[Active Headcount] )
        )
    )
)
 

Best Regards,
Rico Zhou

 

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

That's Perfect @Anonymous !!! Thank you very much! You made my Matrix 100 times better!

 

Just a minor thing, I used [Current Headcount] on Region & Country and the SUM on each Month. 

 

Here's the updated formula and Before & After if someone has the same issue. 

 

_Headcount Table Matrix =
IF (
    ISINSCOPE ( 'Combined Entity Employee'[Month] ),
    CALCULATE ( SUM ( 'Combined Entity Employee'[Total HC] ) ),
    IF (
        ISINSCOPE ( 'Combined Entity Employee'[Country] ),
        [Current Headcount],
        IF (
            ISINSCOPE ( 'Combined Entity Employee'[Region] ),
            [Current Headcount]
        )
    )
)
 
Caesarul_0-1670625087640.png

 

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Users online (27)