想象一下,我有一个事实表,其销售额跨度为3年(2016-2018年)。我有一个图表,按月显示销售额(X轴上为36点)。我有一个选择器来选择Year = 2018,Month = June。
Imagine I have a fact table with sales spanning 3 years (2016-2018). I have a chart showing sales by month (36 points on the X-Axis). I have a slicer selection to Year = 2018, and Month = June.
是否有可能在一定程度上显示从图表开始的6个月切片器选择?换句话说,在切片器仍设置为Year = 2018和Month = January的情况下,图表能否显示6点(过去6个月)?
Is it possible, with a measure, to show on a chart, the trailing 6 months from the slicer selection? In other words, with the slicer still set to Year = 2018 and Month = January, can the chart display 6 points (the trailing 6 months)?
推荐答案
在这种情况下,我将使用的方法是为没有日期的日期创建参数表与我其他表的关系,并使用该日期作为切片器。然后,您将在图表上使用的销售指标写出来,以读取所选日期,并为不在所需范围内的任何日期返回空白。
The approach I would use in this case would be to create a parameter table for the date which doesn't have a relationship with my other tables and use that date for the slicer. Then you'd write the sales measure you use on the chart to read the selected date and return blanks for any dates not within the range you want.
大致如下:
NewSalesMeasure = VAR SelectedDate = SELECTEDVALUE(Slicer[Date]) VAR CurrentDate = SELECTEDVALUE(Sales[Date]) RETURN IF(CurrentDate <= SelectedDate && CurrentDate > DATEADD(SelectedDate, -6, MONTH) SUM(Sales[Amount]), BLANK() )更多推荐
在图表中覆盖切片器筛选器上下文(以显示完整的X轴)
发布评论