How to calculate multiple column values based on condition through measure

  • 5 January 2022
  • 1 reply

i have 4 column(ai_ov_s008,ai_ov_s009,ai_ov_s010,ai_ov_s011) but i need to add condition based on condition we need sum all 4 attribute value so i was created measure like this but its not  sum all 4 values  its only sum two value if we select address type .


  measure: summation_current {
        sql: CASE WHEN ${address_type}="current" then
      ELSE 0
       END ;;

  measure: summation_former {
  sql: CASE WHEN ${address_type}="former" then
  ELSE 0

measure: summation_result{
  type: number
  sql: ${summation_current} + ${summation_former} ;;

This topic has been closed for comments

1 reply

Userlevel 7
Badge +1

I don’t quite understand your post but instead of case statements, you can use filters parameter:

filters: [address_type : “former”]

But I would like to know what results is this giving you and what results are you after? What is the difference?