On this SQLBI video rolling average doesnt calculate anything to totals row? Why is that? Would like to have snapshot value also for rolling value on card etc
Rolling 6M Sales Amount =
VAR numOfMonths = 6
VAR lastSelectedDate = MAX(Dim_DateTable[dte])
VAR period = DATESINPERIOD(Dim_DateTable[dte], lastSelectedDate,-numOfMonths,MONTH)
VAR result =
CALCULATE(
AVERAGEX(
VALUES(Dim_DateTable[Month Of Year]),
[Sales Amount]
),
period
)
VAR lastSalesDate = MAX(Fact_SalesInvoice[Value Date])
VAR firstVisibleDate = MAX(Dim_DateTable[dte])
RETURN
IF(
firstVisibleDate <= lastSalesDate,
result
)
I tried also this
Rolling 6M Sales Amount B =
VAR numOfMonths = 6
VAR rollingSum =
CALCULATE(
[Sales Amount],
DATESINPERIOD(Dim_DateTable[dte], MAX(Dim_DateTable[dte]), -numOfMonths, MONTH)
)
RETURN
rollingSum/numOfMonths
So I’d like to understand why these dont give anything to “Totals” row but then forexample simple SUM-function gives value to totals row. Otherwise I do understand these both measures…