vatojavier
03-14-2024Cloud Apps
Sum based on OR condition
Hi.
I'm trying do a simple sum based on OR condition of 2 column of a table. For now I just want to display a number (that later I will use for a more complex widget) by summing the elements of the table that satisfies a string condition of a column and a number condition of another column.
So, I want to go from this simple SQL query:
select
sum(case when level = 'disabling' or coalesce(problem_issue_id, 1) = 48 then tickets else 0 end)
from fact_tickets f
The closest I could get is by setting this formula withing the widget:
([Total tickets], [level], [problem_issue_id]). In which I filtered [level] to be just "disabling" and [problem_issue_id] to be 48.
The problem is that this formula is setting a AND condition, when I press "Analyze SQL query" button I get this:
How can set that AND condition to be an OR? Is this even the correct path to do this?
Thanks!