分享一波常用的日期动态滚动显示的小技巧,类似的方法还有很多,这里举3个小案例参考。
一、根据所选日期滚动显示近12月的数据(日期为年月格式)
效果图:
实现逻辑:
rolloing_month =
//所选日期为年月格式,根据所选日期,滚动展示12月值
var selectedate = SELECTEDVALUE('D_Calendar'[Year&Month])
var startdate =LEFT(SELECTEDVALUE('D_Calendar'[Year&Month]),4)-1&RIGHT(SELECTEDVALUE('D_Calendar'[Year&Month]),2)
var display =
CALCULATE(SUM(financials[ Sales]),
FILTER(('financials'),
FORMAT('financials'[Date],"yyyymm")>startdate&&FORMAT('