2 Replies Latest reply on Oct 25, 2018 4:41 PM by jon rios

    case with OR

    jon rios

      i would like to build a Case with OR, but it errors


      CASE [parameter selected ]

      when "sales" OR "revenue" OR "income" then

      if len(str( [calculation to run] )) < 3 then

           "$" + str( [calculation to run] )


        • 1. Re: case with OR

          Hey Jon,


          Try this.

          IF [Select Sub Category]='Accessories' or [Select Sub Category]='Art' or [Select Sub Category]='Phones'

          THEN (IF LEN(STR([Profit]))<10 THEN "$"+STR([Profit]) end )

          ELSE '0'



          • 2. Re: case with OR
            jon rios

            thanks, it might work the same but my specific need is a little different.  i dont have a direct measure as condition (like you put [profit])

            i have a calculated field with multiple CASE conditions for metrics and parameter value selected. i am trying to apply formatting labels because some metrics are a % and some are $


            would this example below work?

            1. i create a calculated field which contains my metrics which matches to parameters

            2. then i create another calculated field and use conditional statement to format the values


            do you see an issue with this set-up below???


            "my metrics, calculated field"    <-- for a selected parameter value, run this calculation

            case [my parameter]

            when "% avg buyback" then [buy backs]

            when "% total purchased" then [totals purchase actives]

            when "Penalty risk" then [total risk prem]

            when "situated income' then [income totals]



            "FORMATTING CALCULATED FIELD"     <--- this one i place on row shelf to drive the calculations and also gives me my formatting

            if [my parameter] = "% avg buyback" OR [my parameter] = "situated income" then

            (if len(str( [my metric calculated field]  < 10 then "$" str( [my metric calculated field] end )  //calculation is a $


            left( str( round( ([my metric calculated field] *100), 4)), 4)  //calculation is a %