use hahn;

$week_st = ($date) -> {
    return DateTime::Format('%Y-%m-%d')(Datetime::MakeDate(DateTime::StartOfWeek(cast($date as Date))))
};

select
    week,
    app,
    sum(sessions) as sessions_count
FROM `//home/exp-search/niknik324/sa/datasets/turbosnadira_v2`
where service != 'Погода'
group by
    $week_st(fielddate) as week,
    app
