cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
unpocolocopol
Frequent Visitor

DAX Query fails to prepare

Hi, 

 

I have a report that is based on a DAX query. The DAX Query works fine in DAX Studio and runs in ~1 second.

This query has one parameter. In the query editor, I tried with the parameter:

RSCustomDaxFilter(@CalendarFiscalYear,EqualToCondition,[Calendar].[Fiscal Year],String)

or by replacing with a fixed filter:

FILTER (
'Calendar',
'Calendar'[Fiscal Year] = "FY 2020"
)

 

When I execute this query (with or without the parameter), I have an error message : 

TITLE: Power BI Report Builder
------------------------------

Query preparation failed.

------------------------------
ADDITIONAL INFORMATION:

Object reference not set to an instance of an object. (MDXQueryGenerator)

------------------------------
BUTTONS:

OK
------------------------------

 

This report used to work and stopped working very recently. I have no idea what happened that broke it.

Any ideas?

2 ACCEPTED SOLUTIONS
d_gosbell
Super User II
Super User II

It sounds like your data set has changed mode to an MDX query (I'm not sure what triggers this, but I have seen this setting change on it's own sometimes), if you switch it back to DAX it should resolve this issue.

d_gosbell_0-1617232046593.png

 

View solution in original post

unpocolocopol
Frequent Visitor

I tried this  without success, I copy pasted everything (queries + tablix) in a new blank report and that works. Maybe I switched a setting somewhere or the file was corrupted. I have no idea.

Anyway, now that works.

View solution in original post

3 REPLIES 3
unpocolocopol
Frequent Visitor

I tried this  without success, I copy pasted everything (queries + tablix) in a new blank report and that works. Maybe I switched a setting somewhere or the file was corrupted. I have no idea.

Anyway, now that works.

View solution in original post

d_gosbell
Super User II
Super User II

It sounds like your data set has changed mode to an MDX query (I'm not sure what triggers this, but I have seen this setting change on it's own sometimes), if you switch it back to DAX it should resolve this issue.

d_gosbell_0-1617232046593.png

 

View solution in original post

So the original issue pop up again but I have more info around its context.

 

Same report, I had to change the query a bit (different measure).

My query is a DAX query written with DAX Studio, not generated by the GUI. When I opened the query to change it. I had an error message about not being able to prepare the query, it couldn't execute in the query editor. I copied the query, wipped the query editor clean and switched to MDX. Then I switched back to DAX, pasted the exact same query. The query ran flawlessly in the query editor. Now the report takes ages to refresh (It never refreshed so far). It looks to me that the query editor doesn't like DAX not created by the GUI?

Not sure how to handle this. I cannot recreate the report each time something changes in the query.

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors