• 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
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Dynamic header for automatic updation every month|Power Query|Excel Forum|My Online Training Hub

You are here: Home / Dynamic header for automatic updation every month|Power Query|Excel Forum|My Online Training Hub
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 QueryDynamic header for automatic updati…
sp_PrintTopic sp_TopicIcon
Dynamic header for automatic updation every month
Avatar
Shyam Yarasuri

New Member
Members
Level 0
Forum Posts: 2
Member Since:
July 15, 2021
sp_UserOfflineSmall Offline
1
July 16, 2021 - 10:00 pm
sp_Permalink sp_Print

Hi,

My concern is on how to have a dynamic header so that I can change the month automatically without again rewriting the query every month. Also, help me on moving the data with the change in the month (date) w.r.t. columns.I'm posting a Sample Excel file for reference. Also, I saved the file as Sample Excel.xlsb and zipped (7Z) it for upload. Pl. help me with the issue if you can. Thanks in advance.

Sample Excel : _P sheets are of primary importance. Also, when trying to establish a connection between Resource sheet and _R sheet ( in the data model) , the connection is being established from _R sheet to Resource sheet automatically which should be the other way round. Let me know on what is the issue for that?

 

-Regards,

Shyam 

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
2
July 18, 2021 - 1:12 pm
sp_Permalink sp_Print sp_EditHistory

Hi Shyam,

When you expand columns, edit the M code:

Instead of:

= Table.ExpandTableColumn(#"Filtered Rows", "Content", {"Employment Status#(lf)(1 for Yes, 0 or empty for No)", "Name", "SAP Role", "Competence Level", "Team", "Region", "Practice", "Highest Level#(lf) of Education", "Years of Work #(lf)Experience", "Years of work in Simulation ", "Years of work in Schneider/ Invensys Simulation Team", "FullTime Hour/Month", "May-21", "Jun-21", "Jul-21", "Aug-21", "Sep-21", "Oct-21", "Nov-21", "Dec-21", "Jan-22", "Feb-22", "Mar-22", "Apr-22"}, {"Employment Status#(lf)(1 for Yes, 0 or empty for No)", "Name.1", "SAP Role", "Competence Level", "Team", "Region", "Practice", "Highest Level#(lf) of Education", "Years of Work #(lf)Experience", "Years of work in Simulation ", "Years of work in Schneider/ Invensys Simulation Team", "FullTime Hour/Month", "May-21", "Jun-21", "Jul-21", "Aug-21", "Sep-21", "Oct-21", "Nov-21", "Dec-21", "Jan-22", "Feb-22", "Mar-22", "Apr-22"}),

Use:

= Table.ExpandTableColumn(#"Filtered Rows", "Content", Table.ColumnNames(Table.Combine(#"Filtered Rows"[Content])), Table.ColumnNames(Table.Combine(#"Filtered Rows"[Content])))

From this point, you should select the static columns and unpivot other columns, in order to create a correct tabular structure, what you have there is not right, sending data with expanding columns in Power Pivot data model is pretty useless.

As for the data model, a relationship can be added between 2 columns from 2 tables, but one table should not have duplicates, it is a "1 to many" relationship. In your case, AllDataRes has no duplicates in the Name column, so Power Pivot identifies this table as "1" and DataP as "many" - because it has duplicates in the related column, it's that simple.

You cannot enforce the direction based on what you think it should be, PP knows what is doing and why.

Avatar
Shyam Yarasuri

New Member
Members
Level 0
Forum Posts: 2
Member Since:
July 15, 2021
sp_UserOfflineSmall Offline
3
July 20, 2021 - 8:09 pm
sp_Permalink sp_Print

Hi Catalin,

 

Thanks for the reply. I don't want the data to be transposed after unpivoting the columns. Is there a way to do it as it is but with automation of month in the headers. Also, if you have an example pl. do share.

Also, for the data model when i'm trying to connect AllDataRes to AllDataR (Resource to Resource), it is connecting from AllDataR to AllDataRes. Is there an explanation for this? 

-Thanks,

Shyam 

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
4
July 20, 2021 - 11:06 pm
sp_Permalink sp_Print

Also, for the data model when i'm trying to connect AllDataRes to AllDataR (Resource to Resource), it is connecting from AllDataR to AllDataRes. Is there an explanation for this?

I explained why, you just have to read the explanation.

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Velouria
Guest(s) 11
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 204
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Murat Hasanoglu
Brett Dryland
Saeed Aldousari
Bhuwan Devkota
Kathryn Patton
Maria Conatser
Jefferson Granemann
Glen Coulthard
Nikki Fox
Rachele Dickie
Forum Stats:
Groups: 3
Forums: 24
Topics: 6222
Posts: 27291

 

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