Sum Of Two different type values in Measure

  • 20 January 2022
  • 2 replies

Hi All,


I am having problem with sum of two different type values .

example : i have address_type like  current and former i need to calculate both address type sum value as result .

but when i do sum of current address type fileld i missing former adress type sum values because when i select addresstype its separate current and former.


  measure: Insight_Accts_current {
    type: number
    sql: ${Insight_Active_CA} + ${Insight_Settled_CA} ;;
    filters: [address_type: "current"]
    sql_distinct_key: ${tran_key} ;;
  measure: Insight_Accts_former {
      type: number
      sql: ${Insight_Active_FA} + ${Insight_Settled_FA} ;;
      filters: [address_type: "former"]
    sql_distinct_key: ${tran_key} ;;


here i am adding total sum but i am not getting total sum for current and former 

because if address type current former will be set ‘0’ and if address type former current will be set 0 like that i missing the total sum 


i need both current and former total sum in this below measure 


 measure: Insight_Accts {
    type: number
    sql: ${Insight_Accts_current} + ${Insight_Accts_former};;



above example i pivot the address type so i get the result like above  screenshot  but  i need total sum of 8 +(-368) -360 as result.

so please any one help me out to achieve this result 

This topic has been closed for comments

2 replies

Well I would suggest you to use table calculations to sum both the measures . Let me know if you want any help creating the table calculation

if i use the table calculations i am not getting exact address type sum value ,

because current address values coming separate row and former address values coming separate row in same row we not having both the values.