Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

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

  • 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.

     

     

  • Hi,

    I think it should work, M code

    Let
     Source = Sql.Database("*****", "table", [Query = "select distinct * from anar....."])
    in 
    Source