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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
JayZheng
Advocate I
Advocate I

Power BI server (March 2018 released version) Direct Query CANNOT use built in DAX functions

Power BI server (March 2018 released version) Direct Query CANNOT use built in DAX functions such as SAMEPERIODLASTYEAR(), FIRSTDATE(), LASTDATE()... 

Any thoughts? Given that I don't want to use import mode.

4 REPLIES 4
Anonymous
Not applicable

you would have to use sql if its a sql db, not dax. DAX would be after you get the data loaded.

Lorian
Advocate II
Advocate II

What data source are you trying to query? If it's a database, then you would have to use SQL and not DAX in the query. If its PowerQuery then I have no idea.

Thanks for your response, however, I don't think we are on the same page here. Let me explain, all my datasets are ready for report in SQL server as a view, which I can use direct query option to connect via PBI connection.  The reason I use DAX is for the on screen calculation when user multi-select different charts and graphs.  Now, I want to point one thing out that, it works when I use the normal PBI which is connected to the O365. But it won't work when I deployed it to the PBI on-premise server.  Hope that clarifies things. Again, it's not connection issue and I do not want to use "Import mode" though I know it will work.  Thanks.

I see, sorry, then I don't think I can help.

Are you using DAX to create new columns or new measures? Sometimes I find that some DAX doesn't work in measures but does when I use it to create a new column. But the problem shows itself in the desktop book already before I save to the RS. Does the error specifically refer to DAX as the issue?

I've never really been able to get these SAMEPERIODLASTYEAR() type functions working, even in desktop. There are some relatively messy work-arounds floating about that use filters instead. Maybe one of those will work? I found this very useful: http://radacad.com/dateadd-vs-parallelperiod-vs-sameperiodlastyear-dax-time-intelligence-question

Or perhaps calculate it in your SQL server view instead of PBI? 

 

The problems I've had with DQ on the on-premise RS so far have been access permission related as the user must have direct access to the server themselves to view it; you can't embed another user's credentials (like a shared user) in the data source like you can with import mode.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.