Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi community,
it is possibile using only one parameter in power bi for resolve this SQL query
declare @date as datetime
set @date='2020-08-28 00:00:00.000'
select i.Item,
ISNULL((select count(distinct(CustSupp))
from dbo.MA_SaleDocDetail
where DocumentType = 3407874 and Qty > 0 and DocumentDate between DATEADD(month, -12, @date) and getdate() and Item = i.Item
group by item),0) as NrCustomer,
ISNULL((select sum(Qty)
from dbo.MA_SaleDocDetail
where DocumentType = 3407874 and Qty > 0 and DocumentDate between DATEADD(month, -12, @date) and getdate() and Item = i.Item
group by item),0) as Qty12,
ISNULL((select sum(Qty)
from dbo.MA_SaleDocDetail
where DocumentType = 3407874 and Qty > 0 and DocumentDate between DATEADD(month, -36, @date) and getdate() and Item = i.Item
group by item),0) as Qty36
from dbo.MA_Items I
where i.Disabled = '0'
order by i.Item
Thank you
Hi, @andreaturri27
What do you mean by “using only one parameter in power bi for resolve this SQL query”? Because you just posted a SQL query formula here and you also defined only one parameter “date” in this SQL query.
Here’s a document about Parameter in Power BI, you can take a look and find if it’s helpful:
https://docs.microsoft.com/en-us/power-query/power-query-query-parameters
If you still have a problem, would you like to post some sample data in table form or pbix file(without sensitive data) and your expected result(like the chart you want to get and the correct measure value based on your sample data)?
Thanks very much!
How to Get Your Question Answered Quickly
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Use DATEADD(), EDATE, or SAMEPERIODLASTYEAR.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
103 | |
101 | |
76 | |
66 | |
60 |
User | Count |
---|---|
142 | |
106 | |
103 | |
85 | |
70 |