Logic to get total count of a value from different fields

in Quicksight, i have created 4 fields named topic1, topic2, topic3, topic4 that contain individual topics like ‘Machine Learning’, ‘Data’, ‘App’ etc. now i want to create a calculated field that gives me the total occurrence of each topic by counting its occurrence in each field (topic1, topic2, topic3 and topic4). For ex- if a topic called ‘Data’ is present in topic2 and topic4 and another topic called ‘App’ is present in topic1, topic2, topic3, topic4, then my calculated field should show the count of ‘Data’ as 2 and count of ‘App’ as 4.

Hello @bhardwaj , welcome to the Quicksight community!

I am going to try a something in the meantime to see if this works but could you try the following calculated field and see what it returns?:

//count occurunces of App,Data, or Web
ifelse(
{Topic1} = 'App' OR
{Topic2} = 'App' OR
{Topic3} = 'App',
"App",
etc...,
NULL

I have done something similar to this to count groups of users according to an attribute that didn’t exist in the dataset using logic similar but more complex than what’s above.

Would try that and throw it on a table to see what it returns. This will take some experimentation.