cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vazmor Regular Visitor
Regular Visitor

Compare Equivalent Period and sames Store Last Year

Hello everyone,
I have the following problem, I want to compare the same time period for last year, if I have from 03/01/2018 to 03/21/2018, I need to compare in that period but for the 2017 but additionally that I compare the same stores, this I have achieved separately , the measure sale LY is the one that has the full period of the month with the same stores this is seen when filtering door type and the part of dates I have it in the measure sale LYD that calculates the same period of time, my problem is that I need that calculate the same period of time  and same stores in one and at the end of the month is the same as sale LY.

 

File attachment

 

https://www.dropbox.com/s/qkn6kedmdx3ph7l/Test.pbix?dl=0

1 ACCEPTED SOLUTION

Accepted Solutions
vazmor Regular Visitor
Regular Visitor

Re: Compare Equivalent Period and sames Store Last Year

Solution:

 

Sales Value LYD =
VAR LastDaySelection =
    LASTNONBLANK (
        'Calendar'[Date],
        [Sales Value]
    )
VAR CurrentRange =
    DATESBETWEEN (
        'Calendar'[Date],
        MIN ( 'Calendar'[Date] ),
        LastDaySelection
    )
VAR CurrentStores =
    VALUES ( Sales[Store] )
VAR PreviousRange =
    SAMEPERIODLASTYEAR ( CurrentRange )
VAR _Last =
    CALCULATE (
        [Sales Value],
        PreviousRange,
        CurrentStores
    )
RETURN
    IF (
        [Sales Value LY] = BLANK (),
        BLANK (),
        _Last
    )
3 REPLIES 3
Highlighted
quentin_vigne Senior Member
Senior Member

Re: Compare Equivalent Period and sames Store Last Year

Hi @vazmor

 

Did you try using SAMEPERIODLASTYEAR() command ? 

 

- Quentin

vazmor Regular Visitor
Regular Visitor

Re: Compare Equivalent Period and sames Store Last Year

hello if I tried it but it brings me the whole month and also brings me all the stores without distinction.

vazmor Regular Visitor
Regular Visitor

Re: Compare Equivalent Period and sames Store Last Year

Solution:

 

Sales Value LYD =
VAR LastDaySelection =
    LASTNONBLANK (
        'Calendar'[Date],
        [Sales Value]
    )
VAR CurrentRange =
    DATESBETWEEN (
        'Calendar'[Date],
        MIN ( 'Calendar'[Date] ),
        LastDaySelection
    )
VAR CurrentStores =
    VALUES ( Sales[Store] )
VAR PreviousRange =
    SAMEPERIODLASTYEAR ( CurrentRange )
VAR _Last =
    CALCULATE (
        [Sales Value],
        PreviousRange,
        CurrentStores
    )
RETURN
    IF (
        [Sales Value LY] = BLANK (),
        BLANK (),
        _Last
    )

Helpful resources

Announcements
Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 259 members 2,591 guests
Please welcome our newest community members: