• 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

How to use Parameters in ODBC source|Power Query|Excel Forum|My Online Training Hub

You are here: Home / How to use Parameters in ODBC source|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 QueryHow to use Parameters in ODBC sourc…
sp_PrintTopic sp_TopicIcon
How to use Parameters in ODBC source
Avatar
Dana Sarbulescu
Member
Members

Power Query
Level 0
Forum Posts: 16
Member Since:
October 7, 2022
sp_UserOfflineSmall Offline
1
May 1, 2023 - 8:50 am
sp_Permalink sp_Print

Hi,

 

I use an ODBC function to extract a transaction report out of Quickbooks Desktop. I would like to dynamically filter the name of the customer in the ODBC script. For that I have created a parameter query from a table with one line item that has a drop-down for the customer name. I tried to reference the parameter in the code below, but it returns zero records in the table. My parameter query is called JobName. I wonder if it is just a syntax issue in how I try to reference the parameter. I appreciate any help:

let

    Source = Odbc.Query("dsn=QuickBooks Data 64-Bit QRemote", "sp_report ProfitAndLossDetail show TxnType_Title, Date_Title, RefNumber_Title, Name_Title, Memo_Title, ClearedStatus_Title, SplitAccount_Title, Amount_Title, RunningBalance_Title, Text, Blank, TxnType, Date, RefNumber, Name, Memo, ClearedStatus, SplitAccount, Amount, RunningBalance parameters DateFrom={d'2022-01-01'}, DateTo={d'2023-04-30'}, AccountFilterType = 'CostOfSales', EntityFilterFullNameWithChildren = JobName, ReportBasis = 'Cash'"),

in

    #"Changed Type1"

Thanks,

Dana

Avatar
Alan Sidman
Steamboat Springs, CO
Member
Members


Trusted Members
Level 0
Forum Posts: 150
Member Since:
October 18, 2018
sp_UserOfflineSmall Offline
2
May 1, 2023 - 9:21 am
sp_Permalink sp_Print sp_EditHistory

What does the Mcode look like for the Parameter named JobName?

It should look like this:

let
Source = Excel.CurrentWorkbook(){[Name="TableX"]}[Content],
JobName = Source{0}[JobName]
in
JobName

Where TableX should be the parameter table 

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1824
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
3
May 1, 2023 - 3:51 pm
sp_Permalink sp_Print sp_EditHistory

Salut Dana,

this:

"sp_report ProfitAndLossDetail show TxnType_Title, Date_Title, RefNumber_Title, Name_Title, Memo_Title, ClearedStatus_Title, SplitAccount_Title, Amount_Title, RunningBalance_Title, Text, Blank, TxnType, Date, RefNumber, Name, Memo, ClearedStatus, SplitAccount, Amount, RunningBalance parameters DateFrom={d'2022-01-01'}, DateTo={d'2023-04-30'}, AccountFilterType = 'CostOfSales', EntityFilterFullNameWithChildren = JobName, ReportBasis = 'Cash'"

should look like:

"sp_report ProfitAndLossDetail show TxnType_Title, Date_Title, RefNumber_Title, Name_Title, Memo_Title, ClearedStatus_Title, SplitAccount_Title, Amount_Title, RunningBalance_Title, Text, Blank, TxnType, Date, RefNumber, Name, Memo, ClearedStatus, SplitAccount, Amount, RunningBalance parameters DateFrom={d'2022-01-01'}, DateTo={d'2023-04-30'}, AccountFilterType = 'CostOfSales', EntityFilterFullNameWithChildren = " & JobName & ", ReportBasis = 'Cash'"

I marked in red the double quotes so you can see where they start/end.

Avatar
Dana Sarbulescu
Member
Members

Power Query
Level 0
Forum Posts: 16
Member Since:
October 7, 2022
sp_UserOfflineSmall Offline
4
May 2, 2023 - 2:19 pm
sp_Permalink sp_Print

Hi,

Thank you for the suggestions. Catalin's syntax suggestion seems to work, but i am getting the error message:

Formula.Firewall: Query 'COGS by job' (step 'Source') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination. Not sure what to do from here.

Multumesc!

Dana

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1824
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
5
May 2, 2023 - 3:21 pm
sp_Permalink sp_Print

The answer should be here:

https://excelguru.ca/power-que.....mbination/

Avatar
Dana Sarbulescu
Member
Members

Power Query
Level 0
Forum Posts: 16
Member Since:
October 7, 2022
sp_UserOfflineSmall Offline
6
May 3, 2023 - 1:59 pm
sp_Permalink sp_Print

Thank you! That helps. I was trying to filter the data that is brought in directly in the source step, to help with loading time. But seems like that is not possible so I have to be ok with that 🙂

Really appreciate the extra help.

 

Dana

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Philip Treacy
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: 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: 6356
Posts: 27793

 

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.