Sum and sum_distinct in same measure

  • 20 June 2017
  • 3 replies


I have a measure that I am trying to create which has conditions, and depending on these conditions, will pull data from different data sources. One of the data sources would require a sum_distinct, while others only need sum. How can I have a type of hybrid data type? Is this possible?

Thank you!

3 replies

@jimRL We cannot create a single measure with a hybrid or conditional data type. In your example you would need to break it up so you have two separate measures, one with type: sum and the other with type: sum_distinct.

To add on to what @jesus.cruz said, you do have to have two separate measures, but there is nothing saying you can’t create them as hidden: yes and then make a third measure that is type: number and sql: coalesce(${measure1},${measure2}).

Great additional note @Alison. Thanks!