Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi, I want to show the rolling 5 days Average like below, it should reset after every 5 days
Solved! Go to Solution.
Rolling 5 Days Average =
IF (
HASONEVALUE ( 'Date'[Date] ),
VAR FirstSelectedDate =
CALCULATE ( MIN ( 'Date'[Date] ), ALLSELECTED () )
VAR CurrentDate =
VALUES ( 'Date'[Date] )
VAR DaysDifference =
INT ( CurrentDate - FirstSelectedDate )
VAR DayIndex =
MOD ( DaysDifference, 5 )
VAR Dates =
DATESINPERIOD ( 'Date'[Date], CurrentDate, - DayIndex, DAY )
RETURN
COALESCE ( AVERAGEX ( Dates, [Sales Amont] ), [Sales Amont] )
)
Hi @powerbiexpert22
Please try
Rolling 5 Days Average =
IF (
HASONEVALUE ( 'Date'[Date] ),
VAR FirstSelectedDate =
CALCULATE ( MIN ( 'Date'[Date] ), ALLSELECTED () )
VAR CurrentDate =
VALUES ( 'Date'[Date] )
VAR DaysDifference =
INT ( CurrentDate - FirstSelectedDate )
VAR DayIndex =
MOD ( DaysDifference, 5 )
VAR Dates =
DATESINPERIOD ( 'Date'[Date], CurrentDate, - DayIndex, DAY )
RETURN
AVERAGEX ( Dates, [Sales Amont] )
)
Rolling 5 Days Average =
IF (
HASONEVALUE ( 'Date'[Date] ),
VAR FirstSelectedDate =
CALCULATE ( MIN ( 'Date'[Date] ), ALLSELECTED () )
VAR CurrentDate =
VALUES ( 'Date'[Date] )
VAR DaysDifference =
INT ( CurrentDate - FirstSelectedDate )
VAR DayIndex =
MOD ( DaysDifference, 5 )
VAR Dates =
DATESINPERIOD ( 'Date'[Date], CurrentDate, - DayIndex, DAY )
RETURN
COALESCE ( AVERAGEX ( Dates, [Sales Amont] ), [Sales Amont] )
)
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
24 | |
19 | |
14 | |
10 | |
7 |