Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Compare sales from current and last period, where items from LY is ignored.

Hi!

I am trying to create a single report with CY sales and LY sales using a national retail calendar, T-364 days.

The issue that I am facing is that there are several items that are no longer exist in the current year.  

Due to this, the LY sales excluded these items so the final LY sales amount is not accurate.

Is there a way to do this?  It has to be a single report.

For instance:

LY items: A, B, C, D, E

CY items: B, C, D, E, F

 

Item Name | CY Sales | LY Sales

B

C

D

E

F

 

Item A is excluded.  How do I put item A in the list so the LY sales amount is correct?

 

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

In retail these are typically expressed as Like on Like calculations (LOL).

 

I have created a sample Power BI workbook with some calculations that demonstrate calculating which stores to include in the calculation.

 

Download: Power BI Workbook  

 

2019-07-21_10h31_12.png

 

I have included calculations to calculate the Sales LOL PY. 

 

You will also need calculations to dislay this years values for the same stores, so you can actually do a comparison, so I have included Sales LOL as well.

 

LOL Sales PY = 
VAR varCurrentMonth =
    CALCULATE ( MAX ( 'Date'[Month] ) )
RETURN
    CALCULATE (
        [Sales],
        DATEADD ( 'Date'[Month], -1, YEAR ),
        FILTER (
            'Store',
            CALCULATE (
                DATEADD(FIRSTNONBLANK ( ALL('Date'[Month]), [Sales] ),1,YEAR)
            ) <= varCurrentMonth
        ),
        FILTER (
            'Store',
            CALCULATE (
                LASTNONBLANK( ALL('Date'[Month]), [Sales] )
            ) >= varCurrentMonth
        )
    )
LOL Sales = 
VAR varCurrentMonth =
    CALCULATE ( MAX ( 'Date'[Month] ) )
RETURN
    CALCULATE (
        [Sales],
        FILTER (
            'Store',
            CALCULATE (
                DATEADD(FIRSTNONBLANK ( ALL('Date'[Month]), [Sales] ),1,YEAR)
            ) <= varCurrentMonth
        ),
        FILTER (
            'Store',
            CALCULATE (
                LASTNONBLANK( ALL('Date'[Month]), [Sales] )
            ) >= varCurrentMonth
        )
    )

View solution in original post

1 REPLY 1
Anonymous
Not applicable

In retail these are typically expressed as Like on Like calculations (LOL).

 

I have created a sample Power BI workbook with some calculations that demonstrate calculating which stores to include in the calculation.

 

Download: Power BI Workbook  

 

2019-07-21_10h31_12.png

 

I have included calculations to calculate the Sales LOL PY. 

 

You will also need calculations to dislay this years values for the same stores, so you can actually do a comparison, so I have included Sales LOL as well.

 

LOL Sales PY = 
VAR varCurrentMonth =
    CALCULATE ( MAX ( 'Date'[Month] ) )
RETURN
    CALCULATE (
        [Sales],
        DATEADD ( 'Date'[Month], -1, YEAR ),
        FILTER (
            'Store',
            CALCULATE (
                DATEADD(FIRSTNONBLANK ( ALL('Date'[Month]), [Sales] ),1,YEAR)
            ) <= varCurrentMonth
        ),
        FILTER (
            'Store',
            CALCULATE (
                LASTNONBLANK( ALL('Date'[Month]), [Sales] )
            ) >= varCurrentMonth
        )
    )
LOL Sales = 
VAR varCurrentMonth =
    CALCULATE ( MAX ( 'Date'[Month] ) )
RETURN
    CALCULATE (
        [Sales],
        FILTER (
            'Store',
            CALCULATE (
                DATEADD(FIRSTNONBLANK ( ALL('Date'[Month]), [Sales] ),1,YEAR)
            ) <= varCurrentMonth
        ),
        FILTER (
            'Store',
            CALCULATE (
                LASTNONBLANK( ALL('Date'[Month]), [Sales] )
            ) >= varCurrentMonth
        )
    )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.