Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello PBI community,
I am so stuck.
I have an overtime model which contains the following tables
All visible columns are keys.
I am having a lot of trouble getting a count of active team members that are in table 2 but not table 1 (the ones that did not work overtime), especially when grouped by their respective division. I have managed to create a measure that works as a stand alone calculation with this code...
TEST =
VAR A = MIN('DimDate'[Date])
VAR B =
CALCULATETABLE(
VALUES('DimTeamMember'[EmployeeSK]),
CROSSFILTER('DimTeamMember'[EmployeeSK],'DimTeamMemberList'[EmployeeSK], NONE),
'DimTeamMember'[IsActive] = "Yes",
OR('DimTeamMember'[TerminationDate] >= a, 'DimTeamMember'[TerminationDate] = blank())
)
VAR C = CALCULATETABLE(VALUES('FactOvertime'[EmployeeSK]))
VAR D = COUNTROWS( DISTINCT(EXCEPT(B, C)))
RETURN D
but this measure falls short as I cant break down this total by division. here is an example.
I believe the way the model relationships are set up is necessary for other aspects of reporting because the historical team member dimension is a special case with many attributes.
Is there a way to solve this with dax?
Solved! Go to Solution.
Hi @gftx90 ,
I created a sample pbix file(see attachment), please check whether that is what you want. I updated the formula of your measure [TEST] as below:
TEST =
VAR _curdate =
SELECTEDVALUE ( 'DimDate'[Date] )
VAR _tmembers =
CALCULATETABLE (
VALUES ( 'DimTeamMember'[EmployeeSK] ),
FILTER (
'DimTeamMember',
'DimTeamMember'[IsActive] = "Yes"
&& (
ISBLANK ( 'DimTeamMember'[TerminationDate] )
|| IF (
NOT ( ISBLANK ( 'DimTeamMember'[TerminationDate] ) ),
'DimTeamMember'[TerminationDate] >= _curdate
)
)
)
)
VAR _otmembers =
CALCULATETABLE ( VALUES ( 'FactOvertime'[EmployeeSK] ) )
VAR _ncount =
COUNTROWS ( DISTINCT ( EXCEPT ( _tmembers, _otmembers ) ) )
RETURN
_ncount
Best Regards
Hi @gftx90 ,
I created a sample pbix file(see attachment), please check whether that is what you want. I updated the formula of your measure [TEST] as below:
TEST =
VAR _curdate =
SELECTEDVALUE ( 'DimDate'[Date] )
VAR _tmembers =
CALCULATETABLE (
VALUES ( 'DimTeamMember'[EmployeeSK] ),
FILTER (
'DimTeamMember',
'DimTeamMember'[IsActive] = "Yes"
&& (
ISBLANK ( 'DimTeamMember'[TerminationDate] )
|| IF (
NOT ( ISBLANK ( 'DimTeamMember'[TerminationDate] ) ),
'DimTeamMember'[TerminationDate] >= _curdate
)
)
)
)
VAR _otmembers =
CALCULATETABLE ( VALUES ( 'FactOvertime'[EmployeeSK] ) )
VAR _ncount =
COUNTROWS ( DISTINCT ( EXCEPT ( _tmembers, _otmembers ) ) )
RETURN
_ncount
Best Regards
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
13 | |
12 | |
11 | |
11 | |
8 |