• 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

New field - change type/include in calculation|Power Query|Excel Forum|My Online Training Hub

You are here: Home / New field - change type/include in calculation|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 QueryNew field - change type/include in …
sp_PrintTopic sp_TopicIcon
New field - change type/include in calculation
Avatar
baxbax
Member
Members

Power Query

Power Pivot
Level 0
Forum Posts: 107
Member Since:
July 11, 2016
sp_UserOfflineSmall Offline
1
September 3, 2020 - 12:13 am
sp_Permalink sp_Print

Hi,

I have created a query that picks up source data for the period from Feb 2019 to July 2020. Part of the query is to un-pivot the data so that the months appeared as columns. Doing this creates column fields with a null value. I then selected the month columns and replaced the null values with zero. This also changed the type to decimal numbers. I then added a field that summed up the Feb 2019 to July 2020 fields.

I have now updated the source data to include August 2020. How do I update the query so that it automatically includes August, replaces the null values with zero, changes the field type to decimal numbers and includes it in the calculated field so that it sums up Jan 2019 to August 2020?

Thanks

 

Bax

sp_AnswersTopicSeeAnswer See Answer
Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1529
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
September 3, 2020 - 8:06 am
sp_Permalink sp_Print

Hi Bax,

Please supply your workbook so we don't have to recreate the data and query.

Phil

Avatar
baxbax
Member
Members

Power Query

Power Pivot
Level 0
Forum Posts: 107
Member Since:
July 11, 2016
sp_UserOfflineSmall Offline
3
September 4, 2020 - 12:39 am
sp_Permalink sp_Print

Hi,

Please find the workbook attached. The query is returned in the table in the Sales_Data sheet. The source data is in the Sales sheet.

I created the report initially to look at the periods form Jan 2020 to July 2020. I then added August 2020 data. If you look at the Sales_Data sheet you can see that column Q has returned the numbers for 01/08/20. However in the query there is a step "Replaced Value". This step is to replace any null values in the month columns with zero. If you look at this step in the query you can see that it only picks up the months Jan to July. Similarly in the step "Inserted Sum" I want to sum up all of the months from Jan to August but again it only includes up to July. 

What I want to find out is how to I get these steps to pick up any new months added or is there an alternative method to do what I need?

Thanks

 

BaxInserted_sum.jpgImage Enlarger

Replaced_value.jpgImage Enlarger

sp_PlupAttachments Attachments
  • sp_PlupImage Inserted_sum.jpg (39 KB)
  • sp_PlupImage Replaced_value.jpg (40 KB)
Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4515
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
4
September 5, 2020 - 4:28 pm
sp_Permalink sp_Print

Hi Bax,

In the attached file you can see I created a dynamic list of the columns called 'ColsToAverage' and used that to create the Average column using this code:

= Table.AddColumn(#"Replaced Value", "Average", each List.Average(Record.ToList(Record.SelectFields(_, ColsToAverage))), type number)

I hope that helps.

Mynda

sp_AnswersTopicAnswer
Answers Post
Avatar
baxbax
Member
Members

Power Query

Power Pivot
Level 0
Forum Posts: 107
Member Since:
July 11, 2016
sp_UserOfflineSmall Offline
5
September 7, 2020 - 7:47 pm
sp_Permalink sp_Print

Hi Mynda,

Thanks the dynamic list has resolved my issue. I have not used this functionality before. I will have a play Confused

Thanks again

 

Bax

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Vishal Nevase, John Kobiela, Sue Hammond, Lia Ro, Malcolm Sawyer
Guest(s) 7
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: 6355
Posts: 27792

 

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.