数据模型的年份参数
默认取当前年份和前一年年份
select convert(year(date_sub(curdate(),interval 1 year)),char) as pre_year
union all
select convert(year(curdate()),char) as year_key
这个参数实际上没影响数据集,只是需要影响几个参数派生的字段
年份参数派生的年份格式字段
新建计算度量,环图年份格式
case
when len("${年份}")=0 then '全部'
when len("${年份}")=4 then "${年份}"
when len("${年份}")=9
and substring("${年份}",1,5)<substring("${年份}",6,12)
then
substring("${年份}",1,5)||"+"||substring("${年份}",6,12)
when len("${年份}")=9
and substring("${年份}",1,5)>substring("${年份}",6,12)
then
substring("${年份}",6,12)||"+"||substring("${年份}",1,5)
else '全部'
end
其中,||是字符拼接符号,参数外要用""
饼图需要随年份参数变化的金额
仪表盘年份参数
那么环图年份就会随年份参数变化