Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello Friends,
I am trying to reproduce the following SQL Statement in the Query section of PowerBI Desktop:
select ProductPrice, Quantity from ShoppingCart
where OrderNumber in (select OrderNumber from Orders
where DATEDIFF(day, OrderDate, GETDATE()) <= 365 and OrderFlag = 'C' and OrderSubtotal = 0
)
I can connect to the data source and see the tables. I have created the query (OTQ) for the Orders table, and generate the OrderNumbers. When I create the query (SCQ) for the ShoppingCart table I am unable to reference the values returned by the OTC query. I thought I should use a parameter in the SCQ query, but when I set the parameter to use the reults of an existing query; my OTC query does not show up in the querys list. Is that not the best way to accomplish a sub-query?
I apprecaite your advice.
Cheers,
Peter
Solved! Go to Solution.
HI @pkoel-asb ,
The simple way is copy 1st table t_sql query string and paste it to 2nd table sql statement and use them as sub-query.
In addition, you can extract 'table 1' fields and use text function to convert them as text string, then you can use these text string in 2nd sql statement as filter conditions.
Regards,
Xiaoxin Sheng
Hi @pkoel-asb ,
Current you can't direct invoke t-sql query who created in other query table.
Maybe you can try to create a query parameter to store t-sql query then you can use it in other query table by invoke query parameter.
Regards,
Xiaoxin Sheng
Hello,
How do I push the results of one query into a 2nd query?
Peter
HI @pkoel-asb ,
The simple way is copy 1st table t_sql query string and paste it to 2nd table sql statement and use them as sub-query.
In addition, you can extract 'table 1' fields and use text function to convert them as text string, then you can use these text string in 2nd sql statement as filter conditions.
Regards,
Xiaoxin Sheng
User | Count |
---|---|
141 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
123 | |
101 | |
71 | |
61 |