Question

Using measures multiple times based on parameters


Hi!

Is there a way to repeat measures (or dimensions) multiple times depending on parameters?

To set up the context, I’ve a transactional data, and I want to show sales per customers. But in the explore, I may be interested to know sale between date X and date Y. The following works fine:

parameter: date_start {
type: string
label: "Start Date"
}

parameter: date_end {
type: string
label: "End Date"
}

dimension: date_in_range {
type: yesno
sql: if(${trn_dt} between {% parameter date_start %} and {% parameter date_end %}, true, false);;
}

measure: filtered_sales {
type: sum
sql: ${trn_amnt};;
filters: [date_in_range: "Yes"]
}

But suppose I want to see sales between X1 and Y1, X2 and Y2, and so on. Do I have to create separate parameters and measures for all such? that obviously works, and that’s what I’m doing now, but I was hoping there may be an option to specify parameters only for one dimension, and I can add another dimension again after specifying another pair of dates. Is it possible?


This topic has been closed for comments