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.
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!
Solved! Go to Solution.
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
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 ) )
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
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 ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |