Need help with ifelse- Trying to create calculated field to filter data

Hi

I want to create a calculated field with 2 conditions so that I can use this field as filter. One of the condition in the ifelse condition is a subset of other.

Because of this I am not getting data for one of the

ifelse(
(sku = “1” OR sku = “2” OR sku = “3”),“Level A”,
({Category}=“Box” OR {Category}=“Bag” OR {Category}=“Tube”),“Stationery”,
“Other”
)

SKU 1,2 & 3 are part of Category “Box”

Result Expected
Create a filter using this calculated field
When selecting filter option “Level A” the data (Sales) of SKU 1,2 & 3 is shown
When select filter option “Stationery” (Sales) of “Box” + “Bag” + “Tube” should show including sales of SKU 1,2 & 3 which is part of Box

Currently
Either “Level A” data comes or “Stationery” total does not count SKU 1,2& 3 sales

Thanks in advance for help!

Hey Dalbir,

A couple of things.

First I think you should make a parameter that has two values. “Level A” and “Stationery”. This will allow you to control selecting “Level A” vs “Stationery”

Then make your calculated field this:

ifelse(
${paramater}=“Level A” AND (sku = “1” OR sku = “2” OR sku = “3”),“Valid”,
${paramater}="“Stationery” AND ({Category}=“Box” OR {Category}=“Bag” OR {Category}=“Tube”),“Valid”,
“Other”
)

Finally, have a filter with this calculated field that is equal to “Valid”.

Let me know if that solves your issue

Hi, @DalbirSingh. Welcome to the QuickSight Community! We hope that Max’s solution worked for you. I am marking his reply as, “Solution,” but let us know if this is not resolved.