• 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

Months, Qtrs and Years|Power Query|Excel Forum|My Online Training Hub

You are here: Home / Months, Qtrs and Years|Power Query|Excel Forum|My Online Training Hub

vba course banner

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
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 QueryMonths, Qtrs and Years
sp_PrintTopic sp_TopicIcon
Months, Qtrs and Years
Avatar
Mark Smith
Member
Members
Level 0
Forum Posts: 7
Member Since:
February 19, 2021
sp_UserOfflineSmall Offline
1
February 27, 2021 - 6:59 pm
sp_Permalink sp_Print sp_EditHistory

Hi, I have some data feeding into PowerQuery that I will transform and present in a Power Pivot.

I want to put dates across the columns. The raw data has everything in Months. We want to see the first 6 months or so as months but then group into Qtrs and then group into half years or full years. I think we could use the Excel grouping, but that needs some management on a monthly basis and we would like something that we can feed the months into and the output is effectivelly the groups.

Attached I have 3 sheets for Jan, Feb and Mar as in each Month we need different groups. It is not the case that it is always the first 6 as months and then qtrs as we only want to group into whole quarters. So I am trying to think about the condition if the first month is the 1st, 2nd or 3rd month of the current quarter. So that you will see in the 3 sheets with the expected output column.

Can anyone suggest a solution please?

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4517
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
2
March 1, 2021 - 9:02 am
sp_Permalink sp_Print

Hi Mark,

In Power Pivot you should create a date table. You can then add a column that classifies each date into the periods you want (your Output column in the example file). You can use an IF formula that uses today's date to test if the period should be the current month, a quarter or a half year, that way it auto updates.

This post on fiscal dates should give you some ideas. In Power Pivot we don't have CHOOSE but you can use SWITCH instead. I hope this points you in the right direction. Let me know if you get stuck by suppyling a sample file with your attempt.

Mynda

Avatar
Mark Smith
Member
Members
Level 0
Forum Posts: 7
Member Since:
February 19, 2021
sp_UserOfflineSmall Offline
3
March 1, 2021 - 5:48 pm
sp_Permalink sp_Print

Thanks I had a go following your video and got something working. I am not sure if it is the most efficient code, but it does work, so that solves a problem. My solution is attached. Thanks again

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4517
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
4
March 1, 2021 - 6:24 pm
sp_Permalink sp_Print

Hi Mark,

That's one way. I think you need to change the quarters to state the year before the quarter number otherwise they won't sort properly in the PivotTable.  e.g. 21Q1, 21Q2 etc.

Mynda

Avatar
Mark Smith
Member
Members
Level 0
Forum Posts: 7
Member Since:
February 19, 2021
sp_UserOfflineSmall Offline
5
March 1, 2021 - 6:27 pm
sp_Permalink sp_Print

You are right! Thanks for highlighting! 

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Ashleigh Farquharson
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: 218
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Gilbert Lemek
Ashleigh Farquharson
Jayz Luu
Fred Smith
Charles DeGraffenreaid
Cathi Giard
Sarah Young
Henry Delgado
Alita Nieuwoudt
KL KOH
Forum Stats:
Groups: 3
Forums: 24
Topics: 6360
Posts: 27812

 

Member Stats:
Guest Posters: 49
Members: 32340
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.