TOTAL UNITS [ WHERE ActivityDate - StartDate <= 7] TOTAL UNITS [ WHERE ActivityDate - StartDate > 7 AND ActivityDate - StartDate <= 14 ] ============================== dayid - sale_start_date dimension: activity_minus_start sql: date_diff(${activity_date}, ${startdate}) dim_day - dimension_group: activity type: time timeframes: [date, week, month, dow] sql: ${TABLE}.displaydate In.activity_date - R.sale_start_date F.dayid - R.sale_start_date - dimension: days_since_start type: int sql: ${TABLE}.dayid - dimension: days_from_activity_to_start type: number sql: DATEDIFF(day, ${production.dim_day.activity_date}, ${production.dim_release.sale_start_date}) # - dimension: transaction_type_id # type: int # sql: ${TABLE}.transactiontypeid ### RICK ADDED THIS: If it is incorrect or not best practices, please notify him ### the goal: For a given activity, we need to calculate how many days since sale_start_date ### ie, activity_date - sale_start_date ### the challenge is that activity date is calculated as a day id, whose actual timeStamp value has to be pulled from dim_day ### while the sale_start_date comes from the dim_release - dimension: days_since_start_NOPE type: int sql: ${TABLE}.dayid - dimension: days_since_start type: int sql: ${production.dim_day.activity_date} - ${production.dim_release.sale_start_date}