如何计算月至今的同环比?

环比增量率:((SUM([数量])) - (ZN(LOOKUPDATE(SUM([数量]), DATETRUNC(“MONTH”, [订单日期]), -1, “MONTH”) ALONG DATETRUNC(“MONTH”, [订单日期])))) / (ZN(LOOKUPDATE(SUM([数量]), DATETRUNC(“MONTH”, [订单日期]), -1, “MONTH”) ALONG DATETRUNC(“MONTH”, [订单日期])))

同比增长率:((SUM([数量])) - (ZN(LOOKUPDATE(SUM([数量]), DATETRUNC(“MONTH”, [订单日期]), -1, “YEAR”) ALONG DATETRUNC(“MONTH”, [订单日期])))) / (ZN(LOOKUPDATE(SUM([数量]), DATETRUNC(“MONTH”, [订单日期]), -1, “YEAR”) ALONG DATETRUNC(“MONTH”, [订单日期])))

月至今判断字段:IF DATEPART(“day”, [订单日期])>DATEPART(“day”, today()) THEN 1 ELSE 0(选择0)