This website uses Cookies. Click Accept to agree to our website's cookie use as described in our Privacy Policy. Click Preferences to customize your cookie settings.
@sunnygud answers below:The measure from Step 1 is “${your_sum_measure}”
referenced in step 3. Step 2 is just a 1 or 0. You need Step 3 to put it
all together (sum the field you want to sum, but make it null instead of
0 if all values are null).
For anyone who comes across this while googling like I did, I want to
share another approach that my team uses for these:Create a regular
measure of type: sum but keep it hidden Create another measure (called
for example has_value) of type number for...
I like this idea a lot. I often get requests from our team that could be
answered this way. Usually things like “How many [DIMENSION] had 100+
[MEASURE] in [DATE WINDOW]?” Obviously one can create summary tables and
stuff like that, but those can’t a...
Depending on your SQL dialect you may be able to use a window function,
like: measure: col2_window_total { sql: sum(${col2}) over() ;; } (works
on my Redshift connection)
You could create a derived table for “booking-days”, basically
duplicating the booking record for each day it included. Something like:
select * from date_tbl left join ${bookings.SQL_TABLE_NAME} bookings on
date_tbl.date >= bookings.from_date and da...