Results 1 to 2 of 2

Data not sorting or flowing correctly

Threaded View

  1. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,832

    Re: Data not sorting or flowing correctly

    To me it would seem easier to have the managers fill out the weekly tabs and then aggregate the data using Power Query and Power Pivot to produce the pivot table on the EmpHours sheet so that the data does not become misaligned..
    1. Produce a list of distinct ID's using the following Power Query code:
    let
        Source = Excel.CurrentWorkbook(),
        #"Filtered Rows" = Table.SelectRows(Source, each ([Name] = "tbl_WK1" or [Name] = "tbl_WK2")),
        #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Name"}),
        #"Expanded Content" = Table.ExpandTableColumn(#"Removed Columns", "Content", {"Emoloyee ID"}, {"Emoloyee ID"}),
        #"Removed Duplicates" = Table.Distinct(#"Expanded Content"),
        #"Sorted Rows" = Table.Sort(#"Removed Duplicates",{{"Emoloyee ID", Order.Ascending}}),
        #"Changed Type" = Table.TransformColumnTypes(#"Sorted Rows",{{"Emoloyee ID", Int64.Type}})
    in
        #"Changed Type"
    2. Make connections to both the WK1 and WK2 tables using:
    let
        Source = Excel.CurrentWorkbook(){[Name="tbl_WK1"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Emoloyee ID", Int64.Type}, {"Office", type text}, {"Last", type text}, {"First", type text}, {"WK1 Total", Int64.Type}, {"M", Int64.Type}, {"TU", Int64.Type}, {"W", Int64.Type}, {"TH", Int64.Type}, {"F", Int64.Type}}),
        #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"M", "TU", "W", "TH", "F"})
    in
        #"Removed Columns"
    3. Append the connections to the two tables using:
    let
        Source = Table.Combine({tbl_WK1, tbl_WK2})
    in
        Source
    4. Load the UniqeIDs table and the Append table to the data model
    5. In the Diagrams View of the data model produce a connection between the Employee ID fields of the two tables
    6. Produce the Pivot Table seen on the EmpHours sheet
    Note that when new data is added to either the WK1 or WK2 tables you can select a cell in the Pivot Table and then refresh.
    Note that connections will need to be produced for tbl_WK3 and tbl_WK4 when that data becomes available.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Sorting not working correctly
    By ShotyMcFat in forum Excel General
    Replies: 5
    Last Post: 08-28-2021, 04:44 AM
  2. Not sorting correctly
    By chriswrcg in forum Excel General
    Replies: 7
    Last Post: 07-30-2021, 10:14 AM
  3. Obtain a 'flowing' average from blocks of data
    By JR73 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-16-2021, 03:44 PM
  4. [SOLVED] Power Query Sorting by Date not sorting correctly
    By kersplash in forum Excel General
    Replies: 5
    Last Post: 08-20-2018, 02:59 AM
  5. VB data sorting macro unable to sort correctly
    By Ace of Clubs in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-13-2009, 01:46 AM
  6. Flowing Month Data into a chart based on Weeks?
    By BuzzOffSweetheart in forum Excel General
    Replies: 2
    Last Post: 03-02-2009, 12:36 PM
  7. Not sorting correctly
    By Josh_123456 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2008, 03:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1