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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Douttful
Helper I
Helper I

Issues with calculating total score when multiple periods are selected.

Hello, 

 

I have a complex power bi report that I use for team member preformance in my department. We have a total preformance metric that I have calculated using a measure. The main report time filter is using specific period numbers. I had an incorrect understanding of how measures and filters worked. And was under the assumption that the code was calculating averages. This is not the case. 

 

When a single period is selected, the calculations are correct. But if multiple periods are selected, the calculations are not. I need the measure to average to total score for any of the selected periods. But I have no idea how to do this. Below is a screenshot for reference. 

 

Douttful_1-1708695055944.png

 

All the calculations for Analyst Total Metric Calc (far left columns) are correct. But the total needs to be an average over the periods selected (so (1.95 + 2.70 + 3.30)/3) The correct value for the above table should be 2.65. 

 

 

Trying to write an average measure returns the same value. 

Analyst NEW Total Metric Calc = AVERAGEX('z_Score-TotalMetrics', [Analyst Total Metric Calc]

 

I tried to calculate something that would count the number of distinct periods and then divide the total metric by those periods. But it was doing the total metric calculation THEN dividing. 

 

I thought maybe I needed to make a calculated table where these values can live so I can average them. But I cannot for the life of me figure it out. Also, these reports need to refresh automatically, and I've had some errors where refreshes fail using calculated tables. 

 

I think the table would need to be 

PersonPeriod NumberTotal Score
Person A2023-111.95
Person A2023-122.7
Person A2023-133.3
Person B2023-113.3
Person B2023-123.85
Person B2023-133.6

 

So I could then do AVERAGE (Total Score). 

 

But I'm at my wits end. I was trying to give an example/sample report but it's super complicated and too big to attach here. Please let me know if there's more information that's needed. 

 

Below are the measures and tables involved. My dates table has the period number and period index. 

 

Analyst Total Metric Calc = ---Correct as long as only one period is selected in the filter

VAR _QA = [QA # Metric] * [QA Weighted %]
VAR _L1Resolve = [L1 Resolve # Metric]*[L! Resolve Weighted %]
VAR _TTR =[L1 Time To Resolve # Metric] * [TTR Weighted %]
VAR _KBA = [KBA Use % # Metric]*[KBA Weighted %]
Var _Handle = [Handle Time # Metric]*[Handle Time Weighted %]
VAR _Attendance = [Attendance # Metric]*[Attendance Weighted %]
VAR _Adherence = [Adherence # Metric]*[Adherence Weighted %]
 
VAR _MinIndex = MIN('Filter-Week Number'[Period Index])
 
VAR _TotalMetricCalc = CALCULATE(IF(_MinIndex>31,  _QA + _L1Resolve + _TTR + _KBA + _Handle + _Adherence + _Attendance, DIVIDE([QA # Metric]+[Adherence # Metric]+ [Attendance # Metric]+[L1 Resolve # Metric]+[L1 Time To Resolve # Metric]+[Handle Time # Metric],6 )))
 
RETURN
ROUND(_TotalMetricCalc,2)

 

Period Slicer is just the Period Number with no additonal filters Below is the table for the selected range in the above screenshot. 

Period NumberPeriod Start DatePeriod End DateFiscal YearFiscal Year Start dateFiscal Year End DatePeriod IndexYear Index
2023-1111/5/23 0:0012/2/23 23:5920231/29/23 0:001/27/24 0:00362
2023-1212/3/23 0:0012/30/23 23:5920231/29/23 0:001/27/24 0:00372
2023-1312/31/23 0:002/3/24 23:5920231/29/23 0:001/27/24 0:00382
1 REPLY 1
some_bih
Super User
Super User

Hi @Douttful 

According to formulas, variable _MinIndex use MIN function, this could be main reason you get only one value as min in your case could be only one value.

It is hard to spot your issue, still Try v2 below

Analyst Total Metric Calc v2=
VAR _QA = [QA # Metric] * [QA Weighted %]
VAR _L1Resolve = [L1 Resolve # Metric]*[L! Resolve Weighted %]
VAR _TTR =[L1 Time To Resolve # Metric] * [TTR Weighted %]
VAR _KBA = [KBA Use % # Metric]*[KBA Weighted %]
Var _Handle = [Handle Time # Metric]*[Handle Time Weighted %]
VAR _Attendance = [Attendance # Metric]*[Attendance Weighted %]
VAR _Adherence = [Adherence # Metric]*[Adherence Weighted %]

VAR _MinIndex = SELECTEDVALUE('Filter-Week Number'[Period Index])

VAR _TotalMetricCalc = CALCULATE(
IF(_MinIndex>31, _QA + _L1Resolve + _TTR + _KBA + _Handle + _Adherence + _Attendance, DIVIDE([QA # Metric]+[Adherence # Metric]+ [Attendance # Metric]+[L1 Resolve # Metric]+[L1 Time To Resolve # Metric]+[Handle Time # Metric],6 )))

RETURN
ROUND(_TotalMetricCalc,2)





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

Proud to be a Super User!






Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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