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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Dynamic Query throwing .cpp errors

So, in working on a Power BI project for a company, I found an odd issue in attempting to apply a filter which I will detail below.

I am wondering if anyone else has had such issues, if there is a workaround, or if Microsoft is doing anything to resolve the issues.

 

In attempting to do a lookup, I have created a new Unlinked table with the filter selection values needed, let's call them A, B, C, D, E.

 

Sections of these filters overlap with each other, Everything in A shows up in all of the rest, Sections of B show up in C, Sections of C show up in D, Sections of D show up in E, so a Regular single slicer/filter will not work for this comparison - and this is the reason the filter selections were made into an unlinked table.

 

I utilized a measure to get the current selection value

 

 

SELECTEDVALUE('Table'[Filter], "A")

 

 

So that it was possible to get the selected filter or use the filter that just showed everything if one was not selected. This Measure gave no issues at all and functioned properly.

 

After that, I created a Boolean value column, let's call it [Filter_Visible] in the table that I wanted to utilize the filer on and used an if comparison to check the filter and if the conditions for the filter were true, All of the associated data has been anonymized and the VALUE# sections are actual checks against the enclosed data--

 

 

Filter_Visible = IF([Selected_Filter] = "A", TRUE(),
    IF(AND([Selected_Filter] = "B", 'Table_2'[CheckValue] = VALUE1, TRUE(),
    IF(AND([Selected_Filter] = "C", AND('Table_2'[CheckValue] >= VALUE2A, 'Table_2'[CheckValue] <= VALUE2B)), TRUE(),
    IF(AND([Selected_Filter] = "D", AND('Table_2'[CheckValue] >= VALUE3A, 'Table_2'[CheckValue] <= VALUE3B)), TRUE(),
    IF(AND([Selected_Filter] = "E", AND('Table_2'[CheckValue] >= VALUE4A, 'Table_2'[CheckValue] <= VALUE4B)), TRUE(),FALSE()
    ))))
)

 

 

 

The listed code is where the code breaks and thorws an error --

An unexpected error occured (file 'tmmdmodeltm.cpp', line 2203, function 'MDModelTM::ResolveIMBITableID').

 

This is where I am trying to figure out what went wrong.

Status: New
Comments
v-lili6-msft
Community Support

HI

i couldn't reproduce the problem, could you please share a sample pbix file for us have a test? that will be a great help.

 

 

Regards,

Lin

amattics
Regular Visitor

So, dug into the problem a little bit and found that it is Only in a Direct Query, and will not throw an error in Imported Data for using the methodology described above. I have attached photos of the the error, but I cannot provide a 'working' file with the error, as doing so would potentially expose the internal network.

 

Error Occurs only with Direct Query, and Not with Imported dataError Occurs only with Direct Query, and Not with Imported data

 

Working Imported Data filterWorking Imported Data filter

 

Measure for selected filterMeasure for selected filter

 

v-lili6-msft
Community Support

HI

It seems that you are creating a calculate column, you shouldn't use a measure in a calculate column, that will lead to some problem.

 

and if possible, could you share a simple import model sample pbix file for us have a test? that will be a great help.

 

 

Regards,

Lin