Cummulative last year sales


#1

Hello there !!.. incase anyone is available to answer my query (i know christmas holidays is not the best time for this slight_smile: )

i am struggling with calculating cummulative last year sales with a non standard calendar.

Sales LY = 

VAR CurrentYear = SELECTEDVALUE('calendar'[Sales Year])
VAR CurrentWeekNo = SELECTEDVALUE('calendar'[Sales Week])
VAR CurrentDayOfWeek = SELECTEDVALUE('calendar'[Day of Week])

RETURN
CALCULATE([Total Sales],
    FILTER(ALL('calendar'),
        'calendar'[Day of Week] = CurrentDayOfWeek &&
        'calendar'[Sales Week] = CurrentWeekNo &&
        'calendar'[Sales Year] = CurrentYear - 1
    ))

**** below is not working :

Cummulative LY =

CALCULATE([Sales LY],
    FILTER(ALL('calendar'),'calendar'[Day] <= MAX('calendar'[Day]))

Any help will be great.

Regards
Grace


#2

sorted this one :). …please ignore


#3

That’s great. Do you mind adding the correct solution?

Thanks


#4
Cumulative Sales LY =
VAR SalesYear = [Sales Year]
RETURN
    IF (
        MIN ( 'calendar'[Day] )
            <= CALCULATE ( MAX ( Sales[Sales Date] ), ALL ( Sales ) ),
        CALCULATE (
            [Sales LY],
            FILTER (
                ALL ( 'calendar' ),
                'calendar'[Day] <= MAX ( 'calendar'[Day] )
                    && 'calendar'[Sales Year] = SalesYear
            )
        )
    )

closed #5