This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hey, I need help with an issue in my Power BI measure.
I’m using a measure that creates a virtual table, filters only the active employees, and then performs the count based on each selected value. I also have a template/mapping table that includes a “Total” row.
In the measure, for the Total condition, I specified that it should include records where SUBC is in ("cat1", "cat2"). However, when I drag the measure into the visual, the Total value is not working and is showing as blank.
Could you please help me identify what might be causing this issue?
Please find the dax measure & the matrix visual which i am using.
Its possible that some filters from the visual are still impacting the measure. Try removing the filters on the employee master table as well as the mapping table.
Onroll EXCLUDING Long absent_mmmm =
VAR CurrentRow =
SELECTEDVALUE ( MappingTable[Nature of Work] )
VAR SelectedDate =
MAX ( Getattendance_may[Date] ) -- :white_heavy_check_mark: Build INACTIVE employee code list from attendance
VAR InactiveEmpCodes =
SELECTCOLUMNS (
FILTER (
ALL ( Getattendance_may[EmployeeCode] ),
VAR Emp = Getattendance_may[EmployeeCode]
VAR LastPresentDate =
CALCULATE (
MAX ( Getattendance_may[Date] ),
FILTER (
ALL ( Getattendance_may ),
Getattendance_may[EmployeeCode] = Emp && Getattendance_may[Status] = "Present"
&& Getattendance_may[Date] <= SelectedDate
)
)
VAR TrailingAbsentCount =
CALCULATE (
COUNTROWS ( Getattendance_may ),
FILTER (
ALL ( Getattendance_may ),
Getattendance_may[EmployeeCode] = Emp && Getattendance_may[Status] = "Absent"
&& Getattendance_may[Date] > LastPresentDate
&& Getattendance_may[Date] <= SelectedDate
)
)
RETURN
TrailingAbsentCount >= 8
),
"Code", Getattendance_may[EmployeeCode]
) -- :white_heavy_check_mark: Active EmpMaster = All EmpMaster codes MINUS inactive ones
VAR AllMasterCodes =
SELECTCOLUMNS ( ALL ( GetEmployeeMaster1 ), "Code", GetEmployeeMaster1[Code] )
VAR ActiveMasterCodes =
EXCEPT ( AllMasterCodes, InactiveEmpCodes ) -- :white_heavy_check_mark: Mirror Including measure exactly, just filter EmpMaster to ActiveMasterCodes
VAR TotalMachinist =
CALCULATE (
COUNTROWS ( GetEmployeeMaster1 ),
REMOVEFILTERS ( MappingTable ),
REMOVEFILTERS ( GetEmployeeMaster1 ),
GetEmployeeMaster1[SUBC] IN { "MACHINIST", "SMS (MACHINIST)" },
TREATAS ( ActiveMasterCodes, GetEmployeeMaster1[Code] )
)
VAR TotalInclTrainee =
CALCULATE (
COUNTROWS ( GetEmployeeMaster1 ),
REMOVEFILTERS ( MappingTable ),
REMOVEFILTERS ( GetEmployeeMaster1 ),
GetEmployeeMaster1[SUBC]
IN { "MACHINIST", "SMS (MACHINIST)", "TRAINEE MACHINIST" },
TREATAS ( ActiveMasterCodes, GetEmployeeMaster1[Code] )
)
VAR TotalDM_DNM =
CALCULATE (
COUNTROWS ( GetEmployeeMaster1 ),
REMOVEFILTERS ( MappingTable ),
REMOVEFILTERS ( GetEmployeeMaster1 ),
GetEmployeeMaster1[SUBC]
IN {
"MACHINIST",
"SMS (MACHINIST)",
"TRAINEE MACHINIST",
"NON MACHINIST",
"SMS ( NON-MACHINIST)"
},
TREATAS ( ActiveMasterCodes, GetEmployeeMaster1[Code] )
)
VAR TotalFactory =
CALCULATE (
COUNTROWS ( GetEmployeeMaster1 ),
REMOVEFILTERS ( MappingTable ),
REMOVEFILTERS ( GetEmployeeMaster1 ),
GetEmployeeMaster1[SUBC]
IN {
"MACHINIST",
"SMS (MACHINIST)",
"TRAINEE MACHINIST",
"NON MACHINIST",
"SMS ( NON-MACHINIST)",
"FACTORY STAFF"
},
TREATAS ( ActiveMasterCodes, GetEmployeeMaster1[Code] )
)
VAR NormalCount =
CALCULATE (
COUNTROWS ( GetEmployeeMaster1 ),
REMOVEFILTERS ( MappingTable ),
REMOVEFILTERS ( GetEmployeeMaster1 ),
GetEmployeeMaster1[SUBC] = CurrentRow,
TREATAS ( ActiveMasterCodes, GetEmployeeMaster1[Code] )
)
RETURN
SWITCH (
TRUE (),
CurrentRow = "Total Machinist", TotalMachinist,
CurrentRow = "Total Machinist Incl Trainee", TotalInclTrainee,
CurrentRow = "TOTAL DM + DNM", TotalDM_DNM,
CurrentRow = "Total Factory", TotalFactory,
NormalCount
)
I’m trying to implement this measure, but the total grid is showing blank values. I’ve been stuck on this issue for the past week.
Could anyone please help me with this issue?
Hi @nagendranath,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @Shai_Karmani for the prompt response.
Thank you for sharing the updated measure. Here looks like the issue is not related to the total row names or trailing spaces, here the KEEPFILTERS(ActiveEmpCodes) is not properly applying the active employee filter back onto GetEmployeeMaster1[Code].
Because of this the total rows are getting incorrect values or returning blank.
Apply the same change to all the count variables. This should make the total rows correctly respect the active employee list and return the expected values.
Thanks and regards,
Anjan Kumar Chippa
Hi @Shai_Karmani
Thanks for the reply. I don’t think the issue is related to naming conventions or trailing spaces, as I have already verified those.
As shown in the screenshot, the total should be calculated as 1732 + 47 = 1779. However, the current total is incorrect because it appears to be considering all records from the attendance table.
Hey nagendranath,
I think the screenshot actually narrows it down nicely. Your normal rows work in the EXCLUDING column (1685, 48...) and your Total rows work in the INCLUDING column, so the virtual table and TREATAS are both fine.
if the TotalMachinist branch were really being hit, it couldn't return blank. "MACHINIST" alone already gives 1685, so an IN filter can't collapse to nothing. Blank only happens when the Total rows fall through to NormalCount, which runs SUBC = "Total Machinist". No employee has that SUBC, so you get blank.
So the IF conditions in your EXCLUDING measure aren't matching CurrentRow, even though the same strings match in your Including measure. Usually that's an invisible diff: a trailing space, a non-breaking space, or the two IF blocks just aren't identical.
Two quick ways to find it:
Temporarily change your RETURN to just RETURN CurrentRow, then drop the measure in the matrix. It'll show you the exact text each Total row is sending in. Compare that to what you typed in your IF, they probably don't match perfectly (a stray space, different casing, something small).
Or just open both measures side by side and read the Total lines slowly. The working one and the blank one should be identical, so wherever they differ is your culprit.
The first one is faster, so I'd start there.
If this helped, a thumbs up and accepting the solution would be appreciated.
Best,
Shai Karmani
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 28 | |
| 26 | |
| 25 | |
| 22 | |
| 13 |
| User | Count |
|---|---|
| 59 | |
| 50 | |
| 25 | |
| 20 | |
| 20 |