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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
GlynMThomas
Resolver I
Resolver I

Total Incorrect When Using Multiple Columns

Hi,

 

I have this model setup.

 

GlynMThomas_0-1663949296243.png

 

I have this measure:

 

Admin Estimate Days =
(SUM('WorkTimeData'[Days]) - SUM('Holidays'[Holiday Duration (Days)]) - SUM(Absence[Sick Duration (Days)])) * SUM('Name mapping'[Admin pc])
 
Because the Admin PC column is a fraction this means the total is incorrect in my table:
 
GlynMThomas_1-1663949451925.png

 

I would normally use a column to do this calc and then it would automatically do that calculation first then sum the values up like I want it to. But power bi won't allow me to pull the other columns into one place using RELATED unless it's in a measure which means the calc happens after the aggregation giving me an incorrect total.

 

How would I perform the caculation first before the aggregation?

1 ACCEPTED SOLUTION

Thanks, that kind of worked but introduced some other issues in the aggregation. I managed to solve it in the end with a summarised table combining all the values and aggregating them into 1 row.

View solution in original post

2 REPLIES 2
jgeddes
Super User
Super User

Try this calculated column in the Name mapping table

Calculated Column =
var _holidayDays =
CALCULATE(
    SUM(Holidays[Holiday Duration (Days)]),
    FILTER(Holidays, Holidays[Holiday PeopleHR Name] = Name mapping[PeopleHR Name])
)
var _absenceDays =
CALCULATE(
    SUM(Absence[Sick Duration (Days)]),
    FILTER(Absence, Absence[Absence PeopleHR Name] = Name mapping[PeopleHR Name])
)
var _workDays =
CALCULATE(
    SUM(WorkTimeData[Days]),
    FILTER(WorkTimeData, WorkTimeData[Name] = Name mapping[PeopleHR Name])
)
return
( _workDays - _holidayDays - _absenceDays) * nameTable[admin pc]



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thanks, that kind of worked but introduced some other issues in the aggregation. I managed to solve it in the end with a summarised table combining all the values and aggregating them into 1 row.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.