Convert values using mapping with case

I have 2 columns, primaryAssemblies and secondaryAssemblies.


A person could have "Clinical Care" as their primary assembly.

They are allowed at least 1 secondary assembly. So it may look like "Critical Care, Pediatrics"


I need to count each occurrence like so:

 when `PrimaryAssembly` like '%Allergy Immunology & Inflammation%' or `SecondaryAssemblies` like '%Allergy Immunology & Inflammation%' then 1
 when `PrimaryAssembly` like '%Behavioral Science and Health Services Research%' or `SecondaryAssemblies` like '%Behavioral Science and Health Services Research%' then 2
 when `PrimaryAssembly` like '%Clinical Problems%' or `SecondaryAssemblies` like '%Clinical Problems%' then 3


The values showing in the beast mode field are not correct.

I'm trying to count each occurence, whether in the first column (primaryAssemblies) or second column (secondaryAssemblies).


Any ideas?



  • The output of your case statement there is going to be the number 1, 2, or 3.  Is that what you want?  To display one of those numbers?  

    You asked to count each occurrence, but I'm not seeing a count function here.  Is that aggregation in the card configuration?

  • Yes, I'd like to get the integers to show.

    The counting will be a card feature.


    I hope to then use a Legend:

    1 = "Critical Care"

    2 = "Another item"

    3. .....etc

  • What are you seeing as the output and what are you expecting to see?

    Do you want to count Critical Care or the other values twice if it shows up in both the primaryAssembly and the secondaryAssembly?

    Does your secondaryAssembly always include the text of your primaryAssembly?  If so you could simplify your beast mode by just including the secondaryAssembly comparison

  • "Critical Care" will not show in both columns. It will appear in only one of the columns.

    I want to count each occurence on each row.

  • I'd simplify your beast mode by bringing your assembly values together into one comparison.


    WHEN CONCAT(`PrimaryAssembly`,`SecondaryAssemblies`) like '%Allergy Immunology & Inflammation%' THEN 1
    WHEN CONCAT(`PrimaryAssembly`,`SecondaryAssemblies`) like '%Behavioral Science and Health Services Research%' THEN 2



    Then on the card count your transaction ID or whatever your row identifier is, with this beast mode as the dimension or series.  Does something like that work for you?