Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
I have query from SAP hana that contain start date and end date, I am try to manage this start and end date with Power Query parameters. below is my query
--Khi Branch Receipts by Haider Ali
--Version 1.0
SELECT
T1."TransId",
TO_NVARCHAR(T1."DocDate",'dd-Mon-yy') AS "DDate",
--T1."DocDate",
T1."CounterRef",
T1."CardName",
T1."CardCode",
T1."DocTotal",
T1."Canceled",
T1."CashSum",
T1."TrsfrSum",
T1."Series",
T1."DocTime"
FROM LIVE_SRW."ORCT"
T1 WHERE T1."DocDate" >= '2021-07-01'
AND T1."DocDate" <='2021-08-31'
AND T1."CardCode" LIKE '%KHI%'
ORDER BY T1."DocDate",T1."TransId"
I have tried date parameter and text parameter too
and using advance editor I have replaced Start date with parameter name as below
= SapHana.Database("192.168.1.8:30015", [Query="--Khi Branch Receipts by Haider Ali#(lf)--Version 1.0#(lf)SELECT #(lf)T1.""TransId"",#(lf)TO_NVARCHAR(T1.""DocDate"",'dd-Mon-yy') AS ""DDate"",#(lf)--T1.""DocDate"", #(lf)T1.""CounterRef"",#(lf)T1.""CardName"",#(lf)T1.""CardCode"", #(lf)T1.""DocTotal"",#(lf)T1.""Canceled"",#(lf)T1.""CashSum"",#(lf)T1.""TrsfrSum"", #(lf)T1.""Series"", #(lf)T1.""DocTime""#(lf) FROM LIVE_SRW.""ORCT""#(lf) T1 WHERE T1.""DocDate"" >= 'StartDate'#(lf) AND T1.""DocDate"" <='2021-08-31'#(lf) AND T1.""CardCode"" LIKE '%KHI%' #(lf)ORDER BY T1.""DocDate"",T1.""TransId""", Implementation="2.0"])
but after this following error appear
I just want to manage start and end date of query using parameter
Thanks
Haider Ali
@haider378
You cannot use the parameter inside the sql query. The parameter is created to be used in power bi with M query. For example, I can replace a date value with the parameter in the advanced editor.
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
Thanks for your response,
What I understand it is not possible to change Query using parameter
I use DateTime parameters in SQL queries in Power Query for data from the Data Warehouse.
I don't know how to use M parameters in SQL queries of SAP Hana yet, but it's possible.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 4 | |
| 3 | |
| 3 |