按照季度计算周的问题

由于公司的原因,从3月1号开始算新的1年,这样的话,345,算是第一个季度,678是第二个,然后按照自然月来算,3月1号至3月3号算是第一周,然后3月4日至10日算是第二周,这样排下去image.png,然后等到6月1号的时候,6月1号至2号算是第二季度的第一周,前面的5月27号~31号算是上个季度的最后一周,我现在按照当前日期判断,需要把这个第几周提交入库,请教大佬怎么计算么,image.png

poseidon大佬帮忙写了,公司如下

"第" + NUMTO(IF(DATEDIF(if(or(month(today()) = "3", month(today()) = "4", month(today()) = "5"), CONCATENATE(YEAR(today()), "-03-01"), if(or(month(today()) = "6", month(today()) = "7", month(today()) = "8"), CONCATENATE(YEAR(today()), "-06-01"), if(or(month(today()) = "9", month(today()) = "10", month(today()) = "11"), CONCATENATE(YEAR(today()), "-09-01"), if(month(today()) = "12", CONCATENATE(YEAR(today()), "-12-01"), CONCATENATE(YEAR(today()) - 1, "-12-01"))))), today(), "D") > 7 || WEEK(today()) <> WEEK(if(or(month(today()) = "3", month(today()) = "4", month(today()) = "5"), CONCATENATE(YEAR(today()), "-03-01"), if(or(month(today()) = "6", month(today()) = "7", month(today()) = "8"), CONCATENATE(YEAR(today()), "-06-01"), if(or(month(today()) = "9", month(today()) = "10", month(today()) = "11"), CONCATENATE(YEAR(today()), "-09-01"), if(month(today()) = "12", CONCATENATE(YEAR(today()), "-12-01"), CONCATENATE(YEAR(today()) - 1, "-12-01")))))), IF(WEEKDAY(today()) = 0, ROUNDUP((DATEDIF(if(or(month(today()) = "3", month(today()) = "4", month(today()) = "5"), CONCATENATE(YEAR(today()), "-03-01"), if(or(month(today()) = "6", month(today()) = "7", month(today()) = "8"), CONCATENATE(YEAR(today()), "-06-01"), if(or(month(today()) = "9", month(today()) = "10", month(today()) = "11"), CONCATENATE(YEAR(today()), "-09-01"), if(month(today()) = "12", CONCATENATE(YEAR(today()), "-12-01"), CONCATENATE(YEAR(today()) - 1, "-12-01"))))), today(), "D") - WEEKDAY(today())) / 7, 0), ROUNDUP((DATEDIF(if(or(month(today()) = "3", month(today()) = "4", month(today()) = "5"), CONCATENATE(YEAR(today()), "-03-01"), if(or(month(today()) = "6", month(today()) = "7", month(today()) = "8"), CONCATENATE(YEAR(today()), "-06-01"), if(or(month(today()) = "9", month(today()) = "10", month(today()) = "11"), CONCATENATE(YEAR(today()), "-09-01"), if(month(today()) = "12", CONCATENATE(YEAR(today()), "-12-01"), CONCATENATE(YEAR(today()) - 1, "-12-01"))))), today(), "D") - WEEKDAY(today())) / 7 + 1, 0)), 1)) + "周"

FineReport 圣体叶小凡 发布于 2019-3-27 12:39 (编辑于 2019-3-28 09:53)
1min目标场景问卷 立即参与
回答问题
悬赏:4 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
1
PoseidonLv5高级互助
发布于2019-3-28 09:40

利用日期相减之后跟7相除判断

最佳回答
0
JackWangLv5中级互助
发布于2019-3-27 13:04(编辑于 2019-3-27 13:06)

获取日期在当月中是第几周-http://help.finereport.com/doc-view-2596.html

先获取当月当天是第几周,如果不是本季度的首月,就加上前几个月一共几周,就是本季度的第几周了


  • 6关注人数
  • 769浏览人数
  • 最后回答于:2019-3-28 09:53
    请选择关闭问题的原因
    确定 取消
    返回顶部