Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
userpien
Helper I
Helper I

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 )

1 ACCEPTED SOLUTION
miTutorials
Super User
Super 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.

 

miTutorials_0-1715251981241.png

 

View solution in original post

2 REPLIES 2
Gabry
Responsive Resident
Responsive Resident

Hi,

I think it should work, M code

Let
 Source = Sql.Database("*****", "table", [Query = "select distinct * from anar....."])
in 
Source
miTutorials
Super User
Super 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.

 

miTutorials_0-1715251981241.png

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.