求助

填报月数据,求季度均值和季度环比,不知道公式该怎么写

显示效果图如下:

image.png

显示6个月的数据,要计算两次季度均值

FineReport 端开莹 发布于 2024-3-27 15:52
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
0
华莉星宸Lv7资深互助
发布于2024-3-27 15:59(编辑于 2024-3-27 16:39)

这个需要在SQL里面处理,

或是引用单元格数据

-------------------------例子-----------------------

with aa as (

select '2023-01' as period,100 as ndata from dual

union all

select '2023-02' as period,88 as ndata from dual

union all

select '2023-03' as period,77 as ndata from dual

union all

select '2023-04' as period,85 as ndata from dual

union all

select '2023-05' as period,23 as ndata from dual

union all

select '2023-06' as period,99 as ndata from dual

)

select * from aa

union all

select 'Q1',avg(ndata) from aa where period in ('2023-01','2023-02','2023-03')

union all

select 'Q2',avg(ndata) from aa where period in ('2023-04','2023-05','2023-06')

union all

select '季度环比',(avg(case when period in ('2023-04','2023-05','2023-06') then ndata else null end)-avg(case when period in ('2023-01','2023-02','2023-03') then ndata else null end))/avg(case when period in ('2023-01','2023-02','2023-03') then ndata else null end)

from aa

结果

image.png

最佳回答
0
ID1208Lv6高级互助
发布于2024-3-27 16:00(编辑于 2024-3-27 17:53)

在单元格中根据月数据,计算季度平均数据,和环比数据,然后图表引用单元格数据

-----------------------------------------------

image.png

WorkBook1 - 副本.rar

-----------------------------------------------------------

replace转换一下

image.png

=REPLACE(REPLACE("2024年01月","年","-"),"月","")

  • 3关注人数
  • 327浏览人数
  • 最后回答于:2024-3-27 17:53
    请选择关闭问题的原因
    确定 取消
    返回顶部