Solved

Creating Another Dimension Value Dependent on Other Values of the Same Dimension

  • 26 March 2021
  • 1 reply
  • 33 views

Hey all,

I’m trying to create another value of a dimension that would involve a calculation among other values of the same dimension

 

For example if we had blue, red, orange, green and purple t-shirts and i wanted a value that was the sum of blue and red minus the sum of orange green and purple, how would I go about doing that?

icon

Best answer by JMJ 29 March 2021, 13:15

Hi,

You would create a specific measure for that, something like this:

  measure: total_specific_measure {
    type:sum
    sql: CASE

                  WHEN ${tshirt_color} in ( ‘Blue’,’Red’) THEN 1

                   WHEN ${tshirt_color} in ( ‘Orange’,’Green’,’Purple’) THEN -1

            END ;;
  }

 

 

View original

1 reply

Hi,

You would create a specific measure for that, something like this:

  measure: total_specific_measure {
    type:sum
    sql: CASE

                  WHEN ${tshirt_color} in ( ‘Blue’,’Red’) THEN 1

                   WHEN ${tshirt_color} in ( ‘Orange’,’Green’,’Purple’) THEN -1

            END ;;
  }

 

 

Reply