Hello,
I am new to Looker and I may be on a wrong track but I created a query which is made up of 3 columns: product_id, number_of_sales, number_of_promo_days, number_of_non_promo_days.
What I need to do is create measures that would give me an average number of sales
on promo and non_promo days
What I have is:
measure: number_of_sale_days {
type: count_distinct
sql: ${order_date} ;;
filters: [promo: “yes”]
}
measure: number_of_non_sale_days {
type: count_distinct
sql: ${order_date} ;;
filters: [promo: “no”]
}
But when I try to create a table calculation of ${number_of_sales} / ${number_of_sale_days}
. I can’t set it up because i’m getting this error:
The second argument for "/" must be a Number, but a String was given
Count of _Order Date number_of_sale_days
Type: String
I managed to work around it by creating measures of type number that are referencing initial measures like:
measure: number_of_sale_days_2 {
type: number
sql: ${number_of_sale_days} ;;
}
I wonder if there is a better way of doing this? I planned to create custom measures for that but they are not working at all.
Thanks!