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.
Hi
I am struggling to write the correct DAX for the following:
I have a disconnected table titled Peak Headcount with the format as follows
TechBucket | TechGoal | Division |
Blade Tech 4 Contractors | 67 | US |
Blade Tech 3 Contractors | 80 | US |
Blade Tech 1/2 Employees | 34 | US |
I have a table named DimContractors containing a Primary Role (naming equivalent to TechBucket) which for information I have summarised for reference as below:
I am creating this matrix
Which shows values against the Peak Headcount column showing zero for 3 roles even though they exist in the Peak Headcount table
These are the measures I am using to calculate the Peak Headcount column
Any advice would be appreciated. Thanks
Hi @Richard_Halsall
I have so many doubts but that is probably because I couldn't see the full picture. However, I'm also suspicious about:
VAR Division = SELECTEDVALUE ( 'FactSupply'[ContractType] ) that it probably produces a blank due to more than one value existing in the filter context. Again I'm in the dark here, I don't see what you see but this is just a guess. You may try:
Peak Headcount =
SUMX (
VALUES ( 'FactSupply'[ContractType] ),
VAR Division = 'FactSupply'[ContractType]
VAR US = [Peak Headcount Technician US]
RETURN
IF ( CONTAINSSTRING ( Division, "US" ), US, 0 )
)
Hi, thanks for the quick response and I believe it has highlighted what the issue is but I still do not how to fix it.
It is the VAR Division = SELECTEDVALUE ( 'FactSupply'[ContractType] ) which you corrected to
VAR Division = 'FactSupply'[ContractType]
FactSupply[ContractType] is used in a slicer visual (called 'Text Search Slicer') and the ContractType field contains
US
AU/US
UK/US
hence I was using CONTAINSSTRING as I just want those people with US in that field
Now the values with your corrected measure that are still incorrect appear to be mulitplying if for that role there is a ContractType of US, AU/US and UK/US
Those that are correct only have a ContractType of US
Are you able to assist further. Thanks
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 |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
21 | |
11 | |
10 | |
9 | |
8 |