SalesLY with a Filter


#1

Hello,
I am searching a solution to have the SalesLY for same periode as today.
I explain:

the Context is the FY18 (start in 1 july 2018 to 30june 2019)
the last sales date in the database is 28 september 2018
i would like to compare the sales between 1 july 2018 to 28 september 2018 with the SalesLY for the same periode.

Now I compare Sales for FY18 (3month) with FY17(12month)
I didn’t find how can i put a FILTER.


#2

For this I used DATEADD function but I can not add more then one filter.

VentesLY = CALCULATE(SUM(TOUT[Ligne fact négatif]);DATEADD(Date_Table[Date];-1;YEAR))


#3

Hi Pam,

I have faced a similar scenario and this is the measure I used to resolve that issue:

Sales LY = //  Sales Prior Period including only the same range of days in the YOY comparison.

VAR LastDaySelection =
  LASTNONBLANK ( 'DATE'[Date], [Net Sales])

VAR CurrentRange =
    DATESBETWEEN ( 'DATE'[Date], MIN ( 'DATE'[Date] ), LastDaySelection )

VAR PreviousRange =
SAMEPERIODLASTYEAR ( CurrentRange )
RETURN
    IF (
        LastDaySelection >= MIN ( 'DATE'[Date] ),
        CALCULATE ( [Net Sales], PreviousRange )
    )

I hope this can help :slight_smile:

Lucia


#4

Hi Lucia,
thanks you for your help.

Is what I needed.

Regards


#5

Hi Lucia,
i need a help for finalize this report.

the Ventes_LY is depended to the VENTES context and I want the value Ventes_LY also when the VENTES is 0.

Can I change this ?

because 48.591,86 is not the total of the column . I need all the values.

Regards


#6

I’m a little confused as to what you mean here by your explanation.

Is it you need a different total? Is that what you mean.

Check out these videos below for info on how to do this.