I am currently working on a project where I calculate the NPS for different properties using Looker. I have been able to partition the NPS by property over the last 180 days with the following https://www.googlecloudcommunity.com/gc/Modeling/Max-Date-Time-from-Partitioned-by-Client/m-p/578919...
But after trying to find the max for several attributes, looker crashes and the results don't actually load. How can I solve this issue?
For context, here's how i create my nps score in view file:
measure: ratings_30_days {
type: sum
hidden: yes
sql: CASE WHEN (now()::date - ${created_date}) BETWEEN 0 AND 31 THEN CASE WHEN ${rating} IS NULL THEN 0 ELSE 1 END ELSE NULL END ;;
}
measure: promoters_30_days {
type: sum
hidden: yes
sql: CASE WHEN (now()::date - ${created_date}) BETWEEN 0 AND 31 AND ${rating} > 8 THEN 1 ELSE NULL END ;;
}
measure: detractors_30_days {
type: sum
hidden: yes
sql: CASE WHEN (now()::date - ${created_date}) BETWEEN 0 AND 31 AND ${rating} < 7 THEN 1 ELSE NULL END ;;
}
measure: nps_30_days {
type: number
label: "NPS 30 days"
group_label: "NPS"
sql: CASE WHEN ${ratings_30_days} = 0 THEN 0 ELSE (${promoters_30_days}*100 - ${detractors_30_days}*100)/${ratings_30_days} END ;;
value_format_name: decimal_0
}
}
I'd really appreciate your help, I'm new to looker and feeling a bit overwhelmed using it.