To implement Case Statement in quicksight

I want to check the condition inside the case statement, how can i implement.

Case
when Item_Type in (‘Laptop’,‘Computer’,) then ‘Laptop / PC’
else ‘Cloud services’

this is my sample condition still there are few when statements inside, could someone please help me out with this

You can use the ifelse or switch function

1 Like

Yes I tried with but unfortunately it is throughing error: The syntax of calculated field is incorrect

Maybe you forgot a field. Could you send the syntax that you’ve tried ?

Sure…
switch((Item_Type IN (‘Laptop’,‘Computer’,),‘Laptop / PC’,
Item_Type IN (‘Licences’,‘Virtual Machines Licenses’),‘Cloud Licences’,
Item_Type IN (‘Mobile’,‘Tablet’),‘Mobile’,
Item_Type IN (‘Switch’,‘Access Point’,‘Load Balancer’,‘Appliance’,‘DDI’,‘Firewall’,‘Wireless Access Point’,‘Router’,‘Firewall Logical’,‘Wireless Controller’,‘Event Hubs’),‘Network Equipment’,
Item_Type = ‘Printer’,‘Printer’,
Item_Type IN (‘Hypervisor’,‘Workstation’,‘Server’,‘Storage Node Element’,‘Storage Server’),‘Servers’,
Item_Type In (‘Screen’,‘Keyboard’,‘Mouse’,‘Peripheral’),‘Periperals’,
Item_Type In (‘Bandwidth’),‘Bandwidth’,‘Cloud Applications’)

I’m not sure if you can make the ‘in’ work in a switch function.
It works with an ifelse function :
ifelse(
in({Item_Type}, [‘Laptop’,‘Computer’]),‘Laptop / PC’,
in({Item_Type}, [‘Licences’,‘Virtual Machines Licenses’]),‘Cloud Licences’,

‘Cloud Applications’
)

Oh okay, Thanks a lot, will try with the syntax

ifelse(in({Item_Type}, [‘Laptop’,‘Computer’]),‘Laptop / PC’,

in({Item_Type}, [‘Licences’,‘Virtual Machines Licenses’]),‘Cloud Licences’,

in({Item_Type}, [‘Mobile’,‘Tablet’]),‘Mobile’,

in({Item_Type}, [‘Switch’,‘Access Point’,‘Load Balancer’,‘Appliance’,‘DDI’,‘Firewall’,‘Wireless Access Point’,‘Router’,‘Firewall Logical’,‘Wireless Controller’,‘Event Hubs’]),‘Network Equipment’,

in({Item_Type}, [‘Printer’],‘Printer’,

in({Item_Type}, [‘Hypervisor’,‘Workstation’,‘Server’,‘Storage Node Element’,‘Storage Server’],‘Servers’,

in({Item_Type}, [‘Screen’,‘Keyboard’,‘Mouse’,‘Peripheral’],‘Periperals’,

in({Item_Type}, [‘Bandwidth’],‘Bandwidth’),

[‘Cloud Applications’])

Getting the same error in the last line- The syntax of the calculated field expression is incorrect. Correct the syntax and choose Create again

You forgot some parenthesis (condition 5, 6, 7) and put the parenthesis in the wrong place (condition 8). Also the last value is the default value and should not be in brackets

1 Like

Okay, thank you :), sorry for responding late

1 Like

I see ‘EvaB’ provided a response.
Is this issue resolved or do you require any additional assistance ?
If it is resolved, please kindly mark as resolved.

Thanks

1 Like