简体   繁体   English

Power BI滚动6个月总和

[英]Power BI Rolling 6 Month Sum

I am trying to calculate a 6 month rolling sum of the 'Booked' column pictured below. 我正在尝试计算下图所示“预订”列的6个月滚动总和。 I am still learning Power BI and can't seem to figure out a way to do this. 我仍在学习Power BI,似乎无法找出实现此目的的方法。 Basically, the perfect solution would create another column where each month had a total for the previous 6 months of booked dollars. 基本上,完美的解决方案将创建另一个专栏,其中每个月的前6个月预订额总计。 So for example, 2017-06 would be (1,091,031 + 1,108,326 + 135,000 + 125,327 + 236,515 + 101,296) = 2,797,495 举例来说,2017-06年为(1,091,031 + 1,108,326 + 135,000 + 125,327 + 236,515 + 101,296)= 2,797,495

Thank you!!!! 谢谢!!!!

示例图

Let's assume your table name is "Sales". 假设您的表名是“ Sales”。

First, create several base measures: 首先,创建一些基本措施:

[Total Booked Sales]:= SUM(Sales[Booked])

[Period End]:=LASTDATE('Sales'[Date])

[Period Start]:= FIRSTDATE( DATESINPERIOD('Sales'[Date], [Period End], -6, MONTH))

Then, calculate rolling 6-months sales: 然后,计算连续6个月的销售额:

Sales 6 Months:=CALCULATE( [Total Booked Sales],
DATESBETWEEN ( 'Sales'[Date], [Period Start], [Period End] ))

Side notes: 旁注:

  • These are Measures, not calculated columns. 这些是度量,而不是计算列。
  • Instead of using "date" column in your sales table, you should add Calendar table to your data model ( Calendar tables ) 而不是在销售表中使用“日期”列,您应该将日历表添加到数据模型( 日历表 )中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM