Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

Rolling 6 week average

$
0
0

Hi I think I am missing super simple here but I cannot get this working. I want to show a rolling 6 week average which is working and I want to show a rolling 6 week same period last year. I have the following measures working fine:

 

[This week]

=
ROUND ( SUMX ( Data, Data[Operating] ) / [Total KG], 2 )

 

[This week (LY)]

=
CALCULATE (
    [This week],
    ALL ( DatePeriod ),
    SAMEPERIODLASTYEAR ( 'Date'[Calendar_Date] )
)

 

[Rolling 6 wk operating price]

=
CALCULATE (
    [Operating avg $/kg],
    DATESINPERIOD (
        'Date'[Calendar_Date],
        LASTDATE ( 'Date'[Calendar_Date] ),
        -42,
        DAY
    )
)

 

when I do thie rolling 6 week last year calc it just fails on the continuous date periods but I cant figure out why. it shouldnt as far as I can tell.

 

[Rolling 6 wk operating price Data (LY)] 

=
CALCULATE (
    [This week (LY)],
    DATESINPERIOD (
        'Date'[Calendar_Date],
        LASTDATE ( 'Date'[Calendar_Date] ),
        -42,
        DAY
    )
)

 

Ideas appreciated


Viewing all articles
Browse latest Browse all 213819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>