Reply
avatar user
Anonymous
Not applicable

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
Super User

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

avatar user
Anonymous
Not applicable

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

5 REPLIES 5
tra10wwl
Regular Visitor

I'm experiencing the same too. Is there any solution to this?

avatar user
Anonymous
Not applicable

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.

d_gosbell
Super User
Super User

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

 

avatar user
Anonymous
Not applicable

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.

@Anonymous - did you ever find an acceptable solution to these issues? I'm finding Power BI Report Builder, largely unusable right now. 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x
avatar user

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)