2D Line Chart for 'Target vs Achievement' in date wise progress, filter on Employe

Deepakchoudhary

New Member
Joined
Dec 20, 2010
Messages
40
Office Version
  1. 2016
Platform
  1. Windows
Hello Friends,
Need some ideas to arrange below data in appropriate table and create a Pivot and this Pivot to use to create a 2D line chart (Target vs Achive), where I want to filter on employee.

Date - >
01-03-2024​
01-03-2024​
02-03-2024​
02-03-2024​
03-03-2024​
03-03-2024​
04-03-2024​
04-03-2024​
05-03-2024​
05-03-2024​
Employee ListTargetAchieveTargetAchieveTargetAchieveTargetAchieveTargetAchieve
AB605412711027023057255712121180
BC665114112629826763262213391300
CD545611712024725352450811111050
DE706715214432231768366414471437
EF44399287196180415393880861
FG30346574137158291281617605
GH827717916137935380379217031655
Group Total406378872822184917583920381783118088
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
How about this?
Book1
ABCDEFGHIJKLMNOPQRST
101-03-202401-03-202402-03-202402-03-202403-03-202403-03-202404-03-202404-03-202405-03-202405-03-2024GroupDateTargetAchieveGroup(All)
2Employee ListTargetAchieveTargetAchieveTargetAchieveTargetAchieveTargetAchieveAB01-03-20246054
3AB605412711027023057255712121180AB01-03-20246054Row LabelsGroup's TargetGroup's Achieve
4BC665114112629826763262213391300AB02-03-202412711001-03-2024$812$756
5CD545611712024725352450811111050AB02-03-202412711002-03-2024$1,746$1,644
6DE706715214432231768366414471437AB03-03-202427023003-03-2024$3,698$3,516
7EF44399287196180415393880861AB03-03-202427023004-03-2024$7,840$7,634
8FG30346574137158291281617605AB04-03-202457255705-03-2024$16,618$16,176
9GH827717916137935380379217031655AB04-03-2024572557Grand Total$30,714$29,726
Sheet5
Cell Formulas
RangeFormula
M2:N71M2=TEXTSPLIT(TEXTJOIN(",",TRUE,TOCOL(A3:A9 & "|" & B1:K1,3)),"|",",")
O2:P9O2=INDEX($B$3:$K$9,MATCH($M2,$A$3:$A$9,0),MATCH($N2&O$1,$B$1:$K$1&$B$2:$K$2,0))
Dynamic array formulas.


Then select the data from columns M-P to make a pivot chart.

Screen Shot 2024-03-26 at 7.51.58 AM.png
.
1711457575094.png
 
Upvote 0
Dear Cubist,
I'm very thankful for your reply. Functions giving #NAME? error. I am using Excel 2016 :( and as I googled.. this may be a problem:unsure: behind this error...
 
Upvote 0
I am using Excel 2016

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Dear Cubist,
I'm very thankful for your reply. Functions giving #NAME? error. I am using Excel 2016 :( and as I googled.. this may be a problem:unsure: behind this error...
The solution above is only available in 365. Unfortunately, I don't know how to do it in the 2016 version with formulas. You probably need a VBA.
 
Upvote 0
Assuming your data starts in A1.
Book2
ABCDEFGHIJK
11/3/241/3/242/3/242/3/243/3/243/3/244/3/244/3/245/3/245/3/24
2Employee ListTargetAchieveTargetAchieveTargetAchieveTargetAchieveTargetAchieve
3AB605412711027023057255712121180
4BC665114112629826763262213391300
5CD545611712024725352450811111050
6DE706715214432231768366414471437
7EF44399287196180415393880861
8FG30346574137158291281617605
9GH827717916137935380379217031655
Sheet3


Try this VBA code on a copy. The code should unpivot your data and output to column M. You can use this data to make a pivot chart.
VBA Code:
Sub UnpivotData()
    Dim rng1 As Range, rng2 As Range, rng3 As Range
    Dim a, b, c, v
    Dim lastRow, lastCol, numRow As Long
    Dim ws As Worksheet
    Dim i As Long
   
    Set ws = ThisWorkbook.Worksheets("Sheet3") '<Change sheet name as needed
    Set rng1 = ws.Range("A3:A9") '<- Change to Employee list range
    Set rng2 = ws.Range("B1:K1") '<-Change to Date row range
    Set rng3 = ws.Range("B3:K9") '<- Change to value range
   
    a = rng1.Value
    b = rng2.Value
    v = rng3.Value
   
    numRow = rng1.Count * rng2.Count / 2
    ReDim c(1 To numRow, 1 To 4)
    k = 1
   
    For i = 1 To numRow
        j = i Mod 7
        If j = 0 Then j = 7
        If j = 1 And i > 1 Then k = k + 2

        c(i, 1) = a(j, 1)
        c(i, 2) = b(1, k)
        c(i, 3) = v(j, k)
        c(i, 4) = v(j, k + 1)

    Next i

    ws.Range("M2").Resize(UBound(c, 1), 4).Value = c
End Sub
 
Upvote 0
The mod 7 was hard coded in the above. Should've the # of rows in the a array.
VBA Code:
Sub UnpivotData()
    Dim rng1 As Range, rng2 As Range, rng3 As Range
    Dim a, b, c, v
    Dim lastRow, lastCol, numRow As Long
    Dim ws As Worksheet
    Dim i As Long
  
    Set ws = ThisWorkbook.Worksheets("Sheet3") '<Change sheet name as needed
    Set rng1 = ws.Range("A3:A9") '<- Change to Employee list range
    Set rng2 = ws.Range("B1:K1") '<-Change to Date row range
    Set rng3 = ws.Range("B3:K9") '<- Change to value range
  
    a = rng1.Value
    b = rng2.Value
    v = rng3.Value
  
    numRow = rng1.Count * rng2.Count / 2
    ReDim c(1 To numRow, 1 To 4)
    k = 1
  
    For i = 1 To numRow
        j = i Mod a.rows.count
        If j = 0 Then j = a.rows.count
        If j = 1 And i > 1 Then k = k + 2

        c(i, 1) = a(j, 1)
        c(i, 2) = b(1, k)
        c(i, 3) = v(j, k)
        c(i, 4) = v(j, k + 1)

    Next i

    ws.Range("M2").Resize(UBound(c, 1), 4).Value = c
End Sub
 
Upvote 0

Similar threads

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

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