Pivot Table generating SQL exception when Rows is a blank string

I realized after I built the visual in arena, part of the problem we are experiencing is this works in spice, but not on direct query, so I can’t give a working example of how this is broken. We have a pivot table with calculated fields in the Rows, Columns, and Values so this can be somewhat dynamic. When the ‘Record Type’ is set to Totals Only, we get the “your database generated a SQL Exception…” error.

When you choose any value for ‘Record Type’ that is not ‘Totals Only’ it works.

For some reason it doesn’t like a string being there, rather than a field. And if you create a calculated field that is just a blank string, it still causes the error. This is a snippet of the calculated field that returns the blank string if ‘Totals Only’ is selected.

The most curious thing is, this setup works on other analyses, just not this one. We’ve tried different type casting on strings and dates, but so far nothing resolves it. Putting it in spice does resolve the issue, but I’d like to see if there is a better solution than that.
Any help is much appreciated!

Hello @drew.virgin

Thank you for letting us know. I would recommend filing a case with AWS Support where we can dive into the details so that we can help you further. Here are the steps to open a support case. If your company has someone who manages your AWS account, you might not have direct access to AWS Support and will need to raise an internal ticket to your IT team or whomever manages your AWS account. They should be able to open an AWS Support case on your behalf. Hope this helps!