• 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
    • 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

Filter sheet name from Excel worksheet dynamically via parameter|Power Query|Excel Forum|My Online Training Hub

You are here: Home / Filter sheet name from Excel worksheet dynamically via parameter|Power Query|Excel Forum|My Online Training Hub

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 QueryFilter sheet name from Excel worksh…
sp_PrintTopic sp_TopicIcon
Filter sheet name from Excel worksheet dynamically via parameter
Avatar
Dana Sarbulescu
Member
Members

Power Query
Level 0
Forum Posts: 8
Member Since:
October 7, 2022
sp_UserOfflineSmall Offline
1
January 9, 2023 - 12:31 pm
sp_Permalink sp_Print

Hi,

I am using data from a worksheet to which I add a new tab every month. I am naming each new sheet with the name of the month in the format MMMYY, e.g. Dec22 for December 2022. I need to use data every month from this workbook, but from the sheet that corresponds to the current month. So i set up a parameter that every month returns the name of the month and then when I am pulling into the query the workbook with all the months, I'd like to automatically filter the sheet of the workbook that corresponds with the current month. This always returns an empty table. I assume it has something to do with the syntax. Can anyone help? Can I not use a parameter to filter the name of the sheet? Do I need to use a function?

I am uploading screenshots of the query and the steps. When I manually filter the sheet to "Nov22" it works. But when I use the parameter CurMoName (which is a single item list containing "Nov22") it does not return any results.

Thank you!

sp_AnswersTopicSeeAnswer See Answer
Avatar
Dana Sarbulescu
Member
Members

Power Query
Level 0
Forum Posts: 8
Member Since:
October 7, 2022
sp_UserOfflineSmall Offline
2
January 9, 2023 - 12:34 pm
sp_Permalink sp_Print

The attachment might not have saved in my post. Here it is.

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1800
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
3
January 9, 2023 - 3:21 pm
sp_Permalink sp_Print sp_EditHistory

Hi Dana,
"I am uploading screenshots of the query and the steps. When I manually filter the sheet to "Nov22" it works. But when I use the parameter CurMoName (which is a single item list containing "Nov22") it does not return any results."

Data type is essential, a list is not the same thing as a text string, you need to provide a text instead of a list. CurMoName{0} for example returns the first item in the list.
Instead of a parameter, you can use the system date:
DateTime.ToText(DateTime.LocalNow(),"MMMyy")

sp_AnswersTopicAnswer
Answers Post
Avatar
Dana Sarbulescu
Member
Members

Power Query
Level 0
Forum Posts: 8
Member Since:
October 7, 2022
sp_UserOfflineSmall Offline
4
January 10, 2023 - 3:13 pm
sp_Permalink sp_Print

Hi Catalin,

Thank you for clarifying that aspect of list versus text. I updated the filter to CurMoName{0} and it worked. Very helpful hint. Appreciate the help.

Multumesc mult! πŸ™‚
Dana

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1800
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
5
January 10, 2023 - 4:22 pm
sp_Permalink sp_Print

You're welcome, glad to hear you managed to solve it!

Cu placere πŸ™‚
Catalin

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 170
Currently Online: Ivan Kulubya
Guest(s) 56
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1431
Anders Sehlstedt: 845
Velouria: 574
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 213
A.Maurizio: 202
Aye Mu: 201
Jessica Stewart: 185
Newest Members:
Vicky Otosnika
Abhishek Singh
Kevin Sojourner
Kara Weiss
And Woox
Armani Quenga
moshood bello
annelies b
James1989
lucy gilmour
Forum Stats:
Groups: 3
Forums: 24
Topics: 6045
Posts: 26523

 

Member Stats:
Guest Posters: 49
Members: 31492
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Riny van Eekelen
© Simple:Press —sp_Information
  • 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
 
  • About My Online Training Hub
  • Contact
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

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.

Download A Free Copy of 100 Excel Tips & Tricks

excel tips and tricks ebook

We respect your privacy. We won’t spam you.

x