The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello,
I have a SQL query in which I used parameters (I called them parMaxDate and parMinDate) according to the article https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters
I have a requirement that the user using slicer will affect the results of the query.
Is it possible to assign the maximum and minimum date from the slicer to the parMaxDate and parMinDate parameters respectively?
Hi @obuszek,
As the document said, this feature allows to bind filter at the source query level. But it seems only support the specific type or data sources. What type of data source are you worked on?
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Hi @v-shex-msft ,
I have an Oracle SQL query where the parameter is inside a subquery.
Something like this:
SELECT COUNT(1) AS CNT
FROM TEST.F_DATA F
JOIN TEST.D_DATA D ON D.DIM_ID = F.DIM_ID
JOIN
(
SELECT D.ID_ERP, MAX(D.REV_NUM) AS MAX_REV
FROM TEST.F_DATA F
JOIN TEST.D_DATA D ON D.DIM_ID = F.DIM_ID
WHERE F.DATE_ID BETWEEN @StartDate AND @EndDate
GROUP BY D.ID_ERP
) XX
ON XX.ID_ERP = D.ID_ERP
AND XX.MAX_REV = D.REV_NUM
WHERE D.STATUS = 'Closed'
DATE_ID has a number type. The StartDate and EndDate parameters in Power BI have a Decimal Number type.
I have two dataset (calendars) defined which have two columns (DATE_ID - type number and DATE type date). If I use one-choice filters on the page then everything works as expected.
I found the following articles helpful: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters and https://learn.microsoft.com/en-us/shows/mvp-azure/pass-parameter-to-sql-queries-statement-using-powe...
However, I have a requirement to use a slicer (with a slider) on the DATE field (so that the user can use the DatePicker). I don't know how to pass the minimum and maximum date from the slicer to the StartDate and EndDate parameters.
Is it at all possible to do this?
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
99 | |
93 | |
81 | |
63 | |
56 |
User | Count |
---|---|
248 | |
123 | |
111 | |
78 | |
74 |