cancel
Showing results for 
Search instead for 
Did you mean: 

Filter by multiple conditions using OR logic

Jake_Raz
10 - ETL
10 - ETL

Hello! I'm trying to figure out how to write a formula using measured values that will let me filter down to records meeting either Condition A or Condition B. I can't use the normal filter UI since it operates purely on AND logic. If I add both Condition A and Condition B to the filter panel then it'll only show records that satisfy both requirements. I want records that satisfy either requirement.

Normally I would achieve this through formulas (i.e. measured values). I'd use an IF statement and list out the conditions, and combining with either AND's or OR's depending on what I'm trying to do. Ultimately, everything should resolve to either a 1 or 0, then I'd filter on that (e.g. only show me records that resolve to a "1", meaning they satisfied the requirements in my formula).

However, for this particular example, I've been unable to get this to work correctly, so I thought I'd try using the "advanced filter" in the normal Filter UI. I found this older archived/legacy post that looked promising: https://community.sisense.com/t5/build-analytics/dashboard-filter-date-in-last-180-days-or-null/m-p/...

The example in that post is roughly the same thing I'm trying to do: filter a certain date to show EITHER the last 90 days OR nulls. In other words: show me only the blanks, or if it's NOT blank, then only if it's in the last 90 days. Make sense?

Based on that post I linked above, here's the formula I came up with:

{
  "or": [
    {
      "last": {
        "count": 90,
        "offset": 0
      },
      "custom": true
    },
    {
      "include": {
        "members": [
          null
        ]
      }
    }
  ]
}

This works, in the sense that it doesn't give me any error messages about syntax or invalid query. However, it's exhibiting odd behavior. While it's including the nulls, which I want, the "last" filter is doing the opposite of what I want. Instead of showing the last 90 days, it's showing everything older than 90 days:

Jake_Raz_2-1726679561851.png

If I remove the "include...members" part, and use only the "last" part by itself, THEN it works correctly (note the dates are now correctly in the last 90 days):

Jake_Raz_1-1726679500230.png

How can I achieve both at once? Show the nulls plus only dates in the last 90 days?

If you can suggest a measured value formula I could use instead, then I'll use that method instead. 

 

2 REPLIES 2

Helena_qbeeq
9 - Travel Pro
9 - Travel Pro

hi @Jake_Raz ,

Have you tried using the Filter Relationship editor?

This might answer your needs.

Please let me know if this works for you : )

Always here to help,
Helena from QBeeQ
[email protected]
QBeeQ - Gold Implementation and Development Partner

 

Hi Helena! Unfortunately, it says it requires the "Analytical Engine", which is only in Linux. We're using an older Windows version of Sisense (v8.2.0.10219) so we can't take advantage of that feature.