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
Anonymous
Not applicable

DAX- Incorrect sum of a column based on slicer selection

Hi Community,

Following is a snapshot of my PBI report. I am trying to create a measure based on selection of cost centre. The cost centre selected appears on any of the two columns - 'Primary cost centre' & 'Other cost centres'Capture_emp.PNG

 

Here is the measure :

Total Position Hours =

Var Selectval = values(cost[description])

return

Calculate(sum(Temp[position Hours]),filter(emp, emp[Primary cost centre] in Selectval || emp[Other cost centre] in Seletval))

 

Please note: 'Temp' is a table created from emp table using SUMMARIZE.

Temp = Summarize(emp, position code, position name, emp_code)

 

This measure is giving incorrect result. The expected result in the above example in snapshot is (22.50+38+24+38) =122.50, but the measure results in 146.50. So, its calculating ' position hours' for Assistant account emp codes -002 & 444 twice (24+24), instead of once.

 

Please suggest a solution.Any help is much appreciated.

 

Thanks,

Meena

 

 

 

2 ACCEPTED SOLUTIONS
sturlaws
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

if you provide a sample dataset or sample pbix-file, it is far easier for anyone to help you.

You could try to replace the sum()-part of you expression with something like this:

sumx(SUMMARIZE('Temp';'Temp'[Position code];'Temp'[Position hours]);'Temp'[Position hours])

View solution in original post

Anonymous
Not applicable

Thanks @sturlaws for your response. It would work for someone in similar situation.

Actually, I managed to resolve the issue by modifying a relationship amongst the tables.

 

 

View solution in original post

2 REPLIES 2
sturlaws
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

if you provide a sample dataset or sample pbix-file, it is far easier for anyone to help you.

You could try to replace the sum()-part of you expression with something like this:

sumx(SUMMARIZE('Temp';'Temp'[Position code];'Temp'[Position hours]);'Temp'[Position hours])
Anonymous
Not applicable

Thanks @sturlaws for your response. It would work for someone in similar situation.

Actually, I managed to resolve the issue by modifying a relationship amongst the tables.

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors
Top Kudoed Authors