Forum Discussion
query from sql server to power bi
Hi,
i have to use this query to import table from sql server to power bi. This query is used in bo designer for sql server, and i want to know how to edit this query to be read by power bi to import table correctly. How to edit? Or this query works on power bi too?
Thank you!
SELECT DISTINCT *
FROM ANAR
WHERE DTIN = (SELECT MAX(DTIN)
from ANAR as A
WHERE A.DTIN <= { fn CURDATE() } AND A.cdar = ANAR_C.cdar AND annu = ' ' and a.cdaz= ANARP_C.cdaz )
Yes, you can use the same query in Power BI. Click on Get Data and Select SQL Server, Enter the Server and Database name under Advanced options paste your query and Click on OK.
2 Replies
- miTutorialsSuper User
Yes, you can use the same query in Power BI. Click on Get Data and Select SQL Server, Enter the Server and Database name under Advanced options paste your query and Click on OK.
- GabrySuper User
Hi,
I think it should work, M code
Let Source = Sql.Database("*****", "table", [Query = "select distinct * from anar....."]) in Source