I created a calculated field in an analysis with a SPICE dataset. After setting the dataset to Direct Query (our preferred method), that field now breaks graphs with this error:
Your database generated a SQL exception. This can be caused by query timeouts, resource constraints, unexpected DDL alterations before or during a query, and other database errors. Check your database settings and your query, and try again.
Why would this happen?
Context if this matters:
It’s a calculated field Most Recent 5 Years using a single value string parameter. I use the calculated field in a filter Most Recent 5 Years = 1 which changes the years shown in the visualization. Screen caps below
ifelse(
${ParamYearsToDisplay} = 'Show Full FYs Only',
ifelse(
{_YearDenseRank} <= 6 AND {_YearDenseRank} > 1,
TRUE,
FALSE
),
ifelse(
{_YearDenseRank} <= 5,
TRUE,
FALSE
)
)
This works as expected in SPICE. Showing tables with the values, but we’re actually using it in bar charts.
In Direct Query it throws this error on all visualizations if the field is in the visualization or the filter is enabled:
Your database generated a SQL exception. This can be caused by query timeouts, resource constraints, unexpected DDL alterations before or during a query, and other database errors. Check your database settings and your query, and try again.
Also, I’m also open to retooling this field/parameter set up if there’s a more efficient way to accomplish this. I don’t love having to use the denserank thing but I needed a way to calculate the difference between the absolute max value of the entire Year field vs the value in the given row.

