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
amd567
Frequent Visitor

Absenteeism data issue with the sum of columns based on multiple time types

I am trying to calculate the average FTE per department (Meaningful level). 

The issue I am running into is that I have multiple rows per month for the different Absence Time Types against one FTE value for the month.

 

The avaerage FTE calculation is: RY:Absence Day Total / FTE RY:Final. 

 

To bring the FTE RY: Final value into all rows I am filtering FTE RY:Final based on the department and Reporting Month. 

I am getting the correct value for Average FTE per Row but it is then totaling this at the bottom instead of dividing the total values. 

amd567_0-1650886418147.png

 

So I am looking for the Average FTE to total 2.53 (65.00/25.70) instead of suming all the rows together. 

 

I am assuming I need to use a filter in my calculation but I cant seem tog et the right combination.

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @amd567 ,

 

You can try below formula:

M = 
VAR a =
    SELECTEDVALUE ( 'Table'[Time Type (groups)] )
RETURN
    SUMX (
        FILTER ( ALL ( 'Table' ), 'Table'[Time Type (groups)] = a ),
        [Absences/FTE People 2]
    )

vhenrykmstf_0-1651140684166.png

 

If the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Looking forward to your feedback.


Best Regards,
Henry

View solution in original post

11 REPLIES 11
v-henryk-mstf
Community Support
Community Support

Hi @amd567 ,

 

You can try below formula:

M = 
VAR a =
    SELECTEDVALUE ( 'Table'[Time Type (groups)] )
RETURN
    SUMX (
        FILTER ( ALL ( 'Table' ), 'Table'[Time Type (groups)] = a ),
        [Absences/FTE People 2]
    )

vhenrykmstf_0-1651140684166.png

 

If the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Looking forward to your feedback.


Best Regards,
Henry

vojtechsima
Memorable Member
Memorable Member

Hi, @amd567 
here's how you can manipulate the total:

vojtechsima_0-1650887307974.png

Measure = 
var SegmentCount = COUNTROWS('Average')
var calc_ = CALCULATE( DIVIDE( SUM('Average'[ForAverage]), SegmentCount ))

var no_filter = SUM('Average'[ForAverage])
var last_check  = IF(ISFILTERED('Average'), calc_, no_filter) 

return last_check

For First measure I am returning the "calc_" variable, so naturally if I write the measure like this, I get average even in the total (you can look at that and modify your measure). In the second table I put "last_check" as the return value and it sums up the values if there's no filter.

Hi @vojtechsima thanks for your reply. 

 

I have tried to create a measure from your example but it still doesnt seem to be giving me the desired result. 

 

Measure New = 
var SegmentCount = COUNTROWS('Table')
var calc_ = CALCULATE(DIVIDE( SUM('Table'[Average FTE]), SegmentCount ))

var no_filter = SUM('Table'[Average FTE])
var last_check  = IF(ISFILTERED('Table'), calc_, no_filter) 

return calc_

 

 

It is giving me the correct row level values which I had been able to calculate before but the total value is 0.63. 

 

I would like the total value to show the 2.53. Which is the RY:Absence Day Total / FTE RY: Final. 

 

I think my issue is with the FTE per meaningful level column. This is adding the FTE value together for each Time Type rather than just adding the one value for the month. I.e Feb 2021 should equal juat 12.93 but it is adding this 4 times. 

 

amd567_0-1650901443719.png

This is the column calculation I am using to be able to get the row level FTE per meaningful level breakdown.

 

FTE per meaningful level & Month = CALCULATE(
SUM('Table'[FTE RY: Final]),
FILTER('Table', 'Table'[Business Group 1] = EARLIER('Table'[Business Group 1] )
&& 'Table'[Business Group 2] = EARLIER('Table'[Business Group 2])
&& 'Table'[Meaningful Level] = EARLIER('Table'[Meaningful Level])
&& 'Table'[Reporting Month] = EARLIER('Table'[Reporting Month] ))
)
 
 

Hi,
@amd567 
Any chance you could send a copyable dataset of your data? You can send just some random numbers but keep the structure so I can play with it. Thank you

Hi @vojtechsima 

 

I cant attach a file so hopefully you will be able to copy the below sample. 

 

Business Group 2Meaningful LevelReporting MonthTime TypeTime Type (groups)RY : Absence Day TotalFTE RY: FinalFTE per meaningful level & Month
ESES Process ImprovementFeb-21Sick Leave-Cert.Cert26.5012.933
ESES Process ImprovementFeb-21Not assignedNot assigned012.93312.933
ESES Process ImprovementFeb-21Casual Sick LeaveCasual7012.933
ESES Process ImprovementFeb-21Cas. Sick Leave unpaidCasual1.5012.933
ESES Process ImprovementMar-21Sick Leave-Cert.Cert23.5012.763
ESES Process ImprovementMar-21Not assignedNot assigned012.76312.763
ESES Process ImprovementMar-21Casual Sick LeaveCasual5012.763
ESES Process ImprovementMar-21Cas. Sick Leave unpaidCasual1.5012.763
ESES Process ImprovementApr-21Sick Leave-Cert.Cert23.5012.61
ESES Process ImprovementApr-21Not assignedNot assigned012.6112.61
ESES Process ImprovementApr-21Casual Sick LeaveCasual3012.61
ESES Process ImprovementApr-21Cas. Sick Leave unpaidCasual1.5012.61
ESES ProcurementFeb-21Sick Leave-Cert.Cert245.5057.465
ESES ProcurementFeb-21Not assignedNot assigned057.46557.465
ESES ProcurementFeb-21Casual Sick LeaveCasual32.5057.465
ESES ProcurementMar-21Sick Leave-Cert.Cert203.5056.129
ESES ProcurementMar-21Not assignedNot assigned056.12956.129
ESES ProcurementMar-21Casual Sick LeaveCasual22.5056.129
ESES ProcurementMar-21Cas. Sick Leave unpaidCasual1056.129
ESES ProcurementApr-21Sick Leave-Cert.Cert209.5056.848
ESES ProcurementApr-21Not assignedNot assigned056.84856.848
ESES ProcurementApr-21Casual Sick LeaveCasual18.5056.848
ESES ProcurementApr-21Cas. Sick Leave unpaidCasual1056.848
        

Hi, @amd567 
Thanks for the data, this should fix it:

Absences/FTE People 2 = 

var RY_AbsenceDayTotal =  SUM('Table'[RY : Absence Day Total])
var AverageForRows = SUMX('Table', DIVIDE('Table'[RY : Absence Day Total], 'Table'[FTE per meaningful level & Month]))
var NoFilterResutlt = CALCULATE( DIVIDE(RY_AbsenceDayTotal,  SUM('Table'[FTE RY: Final])) )
var check = IF(HASONEFILTER('Table'[Reporting Month]), AverageForRows, NoFilterResutlt)
return  check

vojtechsima_0-1650907443704.png

 

Hi @vojtechsima 

 

Thansk you so much for that I have that working now! 

 

However, my only issue is that when i filter on the Time Type the total disappears

 

amd567_0-1650963757638.png

amd567_1-1650963795420.png

 

 

 

Hi, @amd567 
that's just because of the design of your calculations. You're dividing by the sum of rows that display 0 and you can't divide by 0 that's why there's a blank value.

Hi @vojtechsima thanks for getting back. 

 

 

Measure New = 
var SegmentCount = COUNTROWS('Table')
var calc_ = CALCULATE( DIVIDE( SUM('Table'[Average FTE]), SegmentCount ))

var no_filter = SUM('Table'[Average FTE])
var last_check  = IF(ISFILTERED('Table'), calc_, no_filter) 

return calc_

I have put my values into your formula above but I am still not getting the desired output so maybe you can see where I am going wrong?

 

I have highlighted the new measure output in yellow, the row values are correct as I had calculated before but this is totaling to 0.63. I want it to total the overall avaerage which is RY:Absence Day Total / FTE RY:Final (65/25.70 = 2.53 highlighted in red)

 

amd567_2-1650894799515.png

 

These are my other calculations which might help, both are columns:

 

Average FTE = ('Table'[RY : Absence Day Total]) /('Table'[FTE per meaningful level & Month])

 

FTE per meaningful level & Month = CALCULATE(

SUM('Table'[FTE RY: Final]),
FILTER('Table', 'Table'[Business Group 1] = EARLIER('Table'[Business Group 1] )
&& 'Table'[Business Group 2] = EARLIER('Table'[Business Group 2])
&& 'Table'[Meaningful Level] = EARLIER('Table'[Meaningful Level])
&& 'Table'[Reporting Month] = EARLIER('Table'[Reporting Month] )))

 

I also tried this measures but as you can see in the table they also dont give the desired output. 

Absences/FTE People = CALCULATE(SUM('Table'[RY : Absence Day Total])/SUM('Table'[FTE RY: Final]))
Absences/FTE People 2 = (SUM('Table'[RY : Absence Day Total])/SUM('Table'[FTE per meaningful level & Month]))

 

I think my issue might be with the FTE per meaningful level & month column suming all the values instead of holding just the one value per month per time type. For example Feb 2021 for that department is 12.93 and March is 12.76 which should total 25.70 but its suming each value for the timetype which is giving 102.78.

 

Is there a way to calcualte this column which will ignore the time type?

 

amd567_3-1650895077015.png

 

 

 

 

 

 

SpartaBI
Community Champion
Community Champion

@amd567 
"The avaerage FTE calculation is: RY:Absence Day Total / FTE RY:Final. "
Is that a column?
If yes, than all you need is to replace it with the equivalent measure:
FTE Measure = SUM(Absence Day Total) / SUM(FTE RY:Final) 
and put this measure in the visual instead of the column

Hi @SpartaBI 

 

Thanks for your reply. 

 

I have tried this in two ways.  

 

 

Absences/FTE People = CALCULATE(SUM('Table'[RY : Absence Day Total])/SUM('Table'[FTE RY: Final])) 
 Gives me the desired output at the bottom of the table (2.53) but no data on the row level. 
 
 
Absences/FTE People 2 = (SUM('Table'[RY : Absence Day Total])/SUM('Table'[FTE per meaningful level & Month]))
Gives me the desired row level data but the incorrect total at the bottom of the table. 
 
Do you have any suggestons on how I might combine these measures to give me the desired result? 
amd567_0-1650901839970.png

 

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.