How to calculate multiple column values based on condition through measure

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
      ${ai_ov_s008}+${ai_ov_s009}
      ELSE 0
       END ;;
  }

  measure: summation_former {
  sql: CASE WHEN ${address_type}="former" then
  ${ai_ov_s010}+${ai_ov_s011}
  ELSE 0
       END;;
  }

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

0 1 306
1 REPLY 1

Dawid
Participant V

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?

Top Labels in this Space
Top Solution Authors