• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

How can I expand (or spill over a week's calendar) to a month's calendar?|Power Query|Excel Forum|My Online Training Hub

You are here: Home / How can I expand (or spill over a week's calendar) to a month's calendar?|Power Query|Excel Forum|My Online Training Hub

vba course banner

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower QueryHow can I expand (or spill over a w…
sp_PrintTopic sp_TopicIcon
How can I expand (or spill over a week's calendar) to a month's calendar?
Avatar
Jim Chen
Member
Members

Power BI
Level 0
Forum Posts: 59
Member Since:
February 20, 2019
sp_UserOfflineSmall Offline
1
July 28, 2020 - 11:43 am
sp_Permalink sp_Print
  1. use Power Query and build a table (above, copied from Student sheet). This table contains a week's data, from Mon to Fri)
  2. I can create a calendar (monthly) using Power Query.
  3. How can I merge them, and expand a week's data to a month's data (excluding weekends), like a spill-over, from the beginning of the month to the end of the month, but excluding weekends?Spill-over.JPGImage Enlarger
sp_PlupAttachments Attachments
  • sp_PlupImage Spill-over.JPG (106 KB)
Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1824
Member Since:
November 8, 2013
sp_UserOnlineSmall Online
2
July 28, 2020 - 4:51 pm
sp_Permalink sp_Print

Hi Jim,

Use this query:

let
Source = Excel.CurrentWorkbook(){[Name="Students2"]}[Content],
#"Removed Columns" = Table.RemoveColumns(Source,{"Tue", "Wed", "Thu", "Fri"}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns", "Mon", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Mon.1", "Mon.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Mon.1", type text}, {"Mon.2", Int64.Type}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Mon.1", "Prefix"}, {"Mon.2", "Days"}}),
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "Custom", each List.Transform({Number.From(#date(2020,8,1))..Number.From(#date(2020,8,31))}, each Date.From(_))),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", (x)=> List.RemoveNulls(List.Transform(x[Custom], each if x[Days]<1+Date.DayOfWeek(_,Day.Monday) then null else _))),
#"Removed Columns1" = Table.RemoveColumns(#"Added Custom1",{"Custom"}),
#"Expanded Custom.1" = Table.ExpandListColumn(#"Removed Columns1", "Custom.1"),
#"Changed Type2" = Table.TransformColumnTypes(#"Expanded Custom.1",{{"Custom.1", type date}}),
#"Renamed Columns1" = Table.RenameColumns(#"Changed Type2",{{"Custom.1", "Date"}}),
#"Added Custom2" = Table.AddColumn(#"Renamed Columns1", "Week-Day", each Text.From(Date.DayOfWeekName([Date]))),
#"Inserted Month" = Table.AddColumn(#"Added Custom2", "Month", each Date.Month([Date]), Int64.Type),
#"Inserted Week of Month" = Table.AddColumn(#"Inserted Month", "Week of Month", each Date.WeekOfYear([Date]), Int64.Type)
in
#"Inserted Week of Month"

From the result of this query, build a pivot table to display the data as you want.

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Catalin Bombea, Vishal Nevase, John Kobiela, Malcolm Sawyer
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 873
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 222
Jessica Stewart: 216
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Melanie Ford
Isaac Felbah
Adele Glover
Hitesh Asrani
Rohan Abraham
Anthony van Riessen
Erlinda Eloriaga
Abisola Ogundele
MARTYN STERRY
Rahim Lakhani
Forum Stats:
Groups: 3
Forums: 24
Topics: 6356
Posts: 27793

 

Member Stats:
Guest Posters: 49
Members: 32324
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.