use hahn;

select 
month,
sum_if(`value`, fc_name='fact') as fact,
sum_if(`value`, fc_name='Амбиция 2021Q2') as ambition,
sum_if(`value`, fc_name='Органический прогноз') as organic_forecast,
sum_if(`value`, fc_name='План') as plan
FROM
`home/comdep-analytics/vakorsakov/planning/increment_dash`
WHERE value_type='Тиры' and sales_group='SMB' and scale='months' and month>='2018-01-01'
GROUP BY ds as month