Excel Power Pivot Lookup

RobF2112

New Member
Joined
Oct 22, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I have a table in an Excel file that contains weekly productivity performance for employees. The columns are:
  1. Week_Ending (end date of week; weeks are Mon-Sun)
  2. Supervisor_Name
  3. Employee_ID
  4. Kronos_Hours
  5. Earned_Hours
  6. Productivity_Pct (static value but calculated as Kronos_Hours/Earned_Hours)
  7. Direct_Utilization_Pct
Data Table

I need to create a report from this table in which a user selects a range of week ending dates and employee IDs. The report should return:
  1. Employee ID
  2. Ending date of the first week the employee worked during the range
  3. Ending date of the last week worked
  4. Number of weeks from first week worked to last week worked
  5. Productivity % for first week worked
  6. Productivity % for last week worked
  7. Rate of change of Productivity % from first week worked to last week worked
Employees may not have worked every week during the period. For example, if the range of week ending dates is 9/5-10/17, an employee may have only worked weeks ending 9/19 through 10/10.

I've used Power Query to add the table to the data Model and then Power Pivot to get 1, 2 (FIRSTDATE), 3 (LASTDATE), and 4 ((LASTDATE-FIRSTDATE)/7).

Power Query

Power Pivot

I need to do a lookup using the employee ID and first week (and again with last week) worked. I've been unsuccessful using DAX functions LOOKUPVALUE and CALCULATE (with and without FILTERS) to return 5 and 6. I can do it in Excel with XLOOKUP and SUMIFS, but using these with the returned pivot table gets ugly when rows are added or removed upon refresh.

I can calculate 7 in two ways.
  • Excel's RRI function
  • ([Last Productivity %]/[First Productivity %])^(1/[# of Weeks])-1
Report Output

I assume that if a Power Pivot solution can be found for 5 and 6, I could plug them into the second method so Power Pivot returns it, too.

Any suggestions on how to do this or a different approach I could use?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
All of your presentations are pictures. Cannot manipulate data in a picture and am not willing to try and recreate your data to solve your issues. Suggest you use XL2BB to upload a representative sample of your data. 8-15 records only. See my signature for instructions on XL2BB.
 
Upvote 0
Thanks for the help wit XL2BB.

Data table:

Report.xlsx
BCDEFGHI
3Week_EndingSupervisor_NameEmployee_IDEmployee_NameKronos_HoursEarned_HoursProductivity_PctDirect_Utilization_Pct
410/17/2021127.3719.1369.9%68.4%
510/17/202125.5831.01555.4%14.0%
610/17/2021339.1832.2382.2%91.7%
710/17/2021435.7546.65130.5%91.6%
810/17/202166.3213.72217.2%19.7%
910/17/2021743.5338.6788.8%92.6%
1010/17/202187.876.4381.7%17.0%
1110/17/202197.6812.51162.9%19.2%
1210/17/2021109.0217.46193.6%24.1%
1310/17/2021118.2813.23159.7%18.0%
1410/17/20211333.1328.9887.5%82.3%
1510/17/20211436.4525.6270.3%92.3%
1610/17/20211539.2024.1661.6%95.2%
1710/17/20211621.209.5945.3%55.4%
1810/17/20211715.7212.4579.2%50.3%
1910/17/20211824.2818.4175.8%78.3%
2010/17/2021197.327.32100.1%91.7%
Weekly_Summary_Data


Desired output:

Report.xlsx
EFGHIJKLMN
1Power PivotExcel formulas that I want to replicate in Power Pivot
2
3XLOOKUP gets value from Weekly_Summary_Data tabAlternative ways to calculate the same value
4
5
6Criteria:Employee_IDEmployee_IDExcel's RRI FunctionArithmetic Operations
7First WeekLast Week
8
9Employee_IDFirst WeekLast Week# of WeeksFirst Prod %Last Prod %Rate of ChangeRate of Change
10109/05/202110/17/2021663.5%69.9%1.60%1.60%
111009/05/202110/17/2021678.6%193.6%16.21%16.21%
1210109/05/202109/12/2021180.2%78.9%-1.63%-1.63%
1310209/05/202109/19/2021216.8%7.9%-31.45%-31.45%
1410409/05/202110/17/2021676.3%56.4%-4.93%-4.93%
1510509/05/202109/19/2021266.2%47.3%-15.45%-15.45%
1610609/05/202110/17/2021687.2%143.6%8.67%8.67%
1710710/10/202110/17/202110.0%0.0%0.00%
1810909/05/202109/12/2021193.3%121.3%29.96%29.96%
191109/05/202110/17/2021640.5%159.7%25.70%25.70%
2011009/05/202110/17/2021677.8%70.4%-1.64%-1.64%
Report
Cell Formulas
RangeFormula
J10:K10J10=XLOOKUP($E10&F10,tbl_weekly_summary_data[Employee_ID]&tbl_weekly_summary_data[Week_Ending],tbl_weekly_summary_data[Productivity_Pct])
J11:K20J11=SUMIFS(tbl_weekly_summary_data[Productivity_Pct],tbl_weekly_summary_data[Employee_ID],$E11,tbl_weekly_summary_data[Week_Ending],F11)
M10:M20M10=IFERROR(RRI($H10,$J10,$K10),"—")
N10:N20N10=IFERROR(($K10/$J10)^(1/$H10)-1,"—")
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top