Millions and Thousands Separator

Pa11
Participant I

Hi Guys,

       I have a measure value as distinct count of transactions, and now I want to show the values based on my parameter selection i.e. Millions and Thousands.

Is there a way to show the values based on the selection parameter.

Below is the code which I had implemented Could you please let me know whether we can do this in few steps.


 


 parameter: select_units {
    type: unquoted
    default_value: "M"
    allowed_value: {label:"Millions" value:"M"}
    allowed_value: {label:"Thousands" value:"K"}

  }

measure: total_transactions {
    type: count_distinct
    sql: ${trans_num};;
 }
 
measure: units {
    label_from_parameter: select_units
    sql:
    {% if select_units._parameter_value == 'M' %}
        1000000
            {% elsif select_units._parameter_value == 'K' %}
        1000
            {% endif %} ;;
}

measure: total_transactions1 {
    type: number
    sql: ${total_transactions}/${units};;
    }
    
    
dimension: units2 {
    label_from_parameter: select_units
    sql:
    {% if select_units._parameter_value == 'M' %}
          " M"
            {% elsif select_units._parameter_value == 'K' %}
           " K"
            {% endif %} ;;
  }

measure: total_transactions2 {
    type: string
    sql: concat(${total_transactions1},${units2});;
    }


 

  
Thanks,

Pavan

0 0 334
0 REPLIES 0
Top Labels in this Space
Top Solution Authors