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

Trying to Create a Parameter where you can Select Multiple Values|Power Query|Excel Forum|My Online Training Hub

You are here: Home / Trying to Create a Parameter where you can Select Multiple Values|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 QueryTrying to Create a Parameter where …
sp_PrintTopic sp_TopicIcon
Trying to Create a Parameter where you can Select Multiple Values
Avatar
nick Bencivengo

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
August 31, 2020
sp_UserOfflineSmall Offline
1
August 31, 2020 - 6:42 am
sp_Permalink sp_Print

I've attached an image of parameters I am using in an excel spreadsheet. I cannot attach the actual spreadsheet for privacy reasons unfortunately. I am using these parameters to filter down a large query from a SQL database. Is there a way to enter or select multiple values for the parameter rather than just having to input them each one by one? For example, I'd like to be able to choose both 2018 and 2019 for the Year rather than having to type them in and look at them separately.

 

I appreciate any insight on this or even if you feel there may be a good way to at least begin to approach this, I'd be happy to hear your thoughts. (i.e. Using VBA or Power Query Advanced Editor to code a solution). Thanks in advance!

parameters.PNGImage Enlarger

sp_PlupAttachments Attachments
  • sp_PlupImage parameters.PNG (14 KB)
sp_AnswersTopicSeeAnswer See Answer
Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4616
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
2
August 31, 2020 - 9:12 am
sp_Permalink sp_Print

Hi Nick,

Welcome to our forum.

If you want to filter by multiple year parameters you need to create a list containing those years, then you can use the List.Contains function in your Fact Table query and use this formula:

= Table.SelectRows(#"Name of last step", each List.Contains(YearParameterTable , [YearColumn]))

Hope that points you in the right direction. If you get stuck, please create a mock up sample file with a small amount of dummy data and your query attempt and we'll help you troubleshoot.

Mynda

Avatar
nick Bencivengo

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
August 31, 2020
sp_UserOfflineSmall Offline
3
September 1, 2020 - 5:59 am
sp_Permalink sp_Print

Hi Mynda, 

Thank you for the suggestion! I'll work on creating a dummy file and test that out.

Nick

Avatar
nick Bencivengo

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
August 31, 2020
sp_UserOfflineSmall Offline
4
September 11, 2020 - 12:45 am
sp_Permalink sp_Print

Hello,

 

I've created a dummy file, which is attached. Ideally, I'd like to be able to filter on multiple values in each cell of the Parameter table (on the Query with Param Sheet). I did create lists as you proposed, and I created connections to those lists. If this is likely the only way to filter by multiple values, that's fine too.

The only part of your formula I was getting stuck on was the [YearColumn]. I'm not sure what to put there. Do I need to rename the list columns and create connections for those?

 

Thank you,

 

Nick

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4616
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
5
September 11, 2020 - 10:04 am
sp_Permalink sp_Print

Hi Nick,

Thanks for sharing your file. When you first asked the question I didn't realise you wanted to filter multiple fields based on multiple parameters, I thought you only wanted to filter the Year field on multiple parameters.

In the attached file I've inserted the filters for the 4 different fields based on your parameter tables. Note: you need to remove the items from the parameter tables on the Lists sheet that you want filtered out. You cannot simply filter these tables in the Excel worksheet, as Power Query will still include items that are in rows filtered in the Excel worksheet.

Hope that makes sense.

Mynda

sp_AnswersTopicAnswer
Answers Post

The following users say thank you to Mynda Treacy for this useful post:

Alan Sidman
Avatar
nick Bencivengo

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
August 31, 2020
sp_UserOfflineSmall Offline
6
September 11, 2020 - 10:42 pm
sp_Permalink sp_Print

Thanks so much Mynda! That's very helpful.

Avatar
nick Bencivengo

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
August 31, 2020
sp_UserOfflineSmall Offline
7
September 17, 2020 - 9:42 am
sp_Permalink sp_Print

Hello again,

 

Bear with me as I am a fairly new user of Power Query. I really appreciate the help with creating the list parameters, but I'd like to go a step further. If the parameter lists are left blank, I'd like the query to return all values for that parameter. For example, if I were to clear out the values for the Year list, I'd like the query to only filter by the remaining parameters. Is there a way to do this?

 

Thank you,

 

Nick

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Andrea Lavender, Herbie Key
Guest(s) 6
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
Hans Hallebeek: 184
Newest Members:
Hilary Burchfield
Richie Wright
Adel Kock
Barbara Murray
Doug Milne
https://www.afabola.net/
Siobhan Stringer
Rob Rooth
Tom Lewis
Jennifer Rodriguez-Avila
Forum Stats:
Groups: 3
Forums: 24
Topics: 6540
Posts: 28628

 

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

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • 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

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

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

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.