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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply

Need to Calculate same store sales growth % in PowerBI

Dhrutivyasa070_0-1716354761972.png

Above image shows sales for "store 1" for 2023 and 2024 

1. In 2023 store 1 runs for 10 days in april & 8 days in May 

2. In 2024 Store 1 runs 15 days in Both April & May .

i need to calculate Growth over Last year same period . but only till date where last year store was working 

example: In Month of April'23 Store sales punched till 10th day  so cosider sales for April'24 till 10th date only .

same for May'24 , in may'23 Store sales punched till 8th date but in May'24 it was working till 15th date but consider sales till 8th date for may month . 

i need to calculate same store sales growth for same period last year by using above logic ,

(cy sales-ly sales)/Ly sales

Help me with this logic

thanks in advance .

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @Dhrutivyasa-070 ,

 

Thanks @PurpleGate  for the quick reply!

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

vtangjiemsft_0-1716449478561.pngvtangjiemsft_1-1716449497819.png

(2) We can create measures. 

ly sales = 
 var _apr=CALCULATE(SUM('2023'[April]),FILTER(ALLSELECTED('2023'),'2023'[Store]=MAX('2023'[Store])))
 var _may=CALCULATE(SUM('2023'[May]),FILTER(ALLSELECTED('2023'),'2023'[Store]=MAX('2023'[Store])))
 RETURN _apr+_may
cy sales = 
 var _apr_day=CALCULATE(MAX('2023'[DAY]),FILTER(ALLSELECTED('2023'),'2023'[Store]=MAX('2023'[Store]) && '2023'[April]<>BLANK()))
 var _may_day=CALCULATE(MAX('2023'[DAY]),FILTER(ALLSELECTED('2023'),'2023'[Store]=MAX('2023'[Store]) && '2023'[May]<>BLANK()))
 var _apr=CALCULATE(SUM('2024'[April]),FILTER(ALLSELECTED('2024'),'2024'[DAY]<=_apr_day && '2024'[Store]=MAX('2023'[Store])))
 var _may=CALCULATE(SUM('2024'[May]),FILTER(ALLSELECTED('2024'),'2024'[DAY]<= _may_day && '2024'[Store]=MAX('2023'[Store])))
 RETURN _apr+_may

(3) Then the result is as follows.

vtangjiemsft_2-1716449553249.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

3 REPLIES 3
v-tangjie-msft
Community Support
Community Support

Hi @Dhrutivyasa-070 ,

 

Thanks @PurpleGate  for the quick reply!

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

vtangjiemsft_0-1716449478561.pngvtangjiemsft_1-1716449497819.png

(2) We can create measures. 

ly sales = 
 var _apr=CALCULATE(SUM('2023'[April]),FILTER(ALLSELECTED('2023'),'2023'[Store]=MAX('2023'[Store])))
 var _may=CALCULATE(SUM('2023'[May]),FILTER(ALLSELECTED('2023'),'2023'[Store]=MAX('2023'[Store])))
 RETURN _apr+_may
cy sales = 
 var _apr_day=CALCULATE(MAX('2023'[DAY]),FILTER(ALLSELECTED('2023'),'2023'[Store]=MAX('2023'[Store]) && '2023'[April]<>BLANK()))
 var _may_day=CALCULATE(MAX('2023'[DAY]),FILTER(ALLSELECTED('2023'),'2023'[Store]=MAX('2023'[Store]) && '2023'[May]<>BLANK()))
 var _apr=CALCULATE(SUM('2024'[April]),FILTER(ALLSELECTED('2024'),'2024'[DAY]<=_apr_day && '2024'[Store]=MAX('2023'[Store])))
 var _may=CALCULATE(SUM('2024'[May]),FILTER(ALLSELECTED('2024'),'2024'[DAY]<= _may_day && '2024'[Store]=MAX('2023'[Store])))
 RETURN _apr+_may

(3) Then the result is as follows.

vtangjiemsft_2-1716449553249.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

PurpleGate
Resolver III
Resolver III

You could try using SAMEPERIODLASTYEAR()

 

In my example I have numbers in 2023 up until 28th December 2023 but in 2024 I have only up until 17th May 2024. 

 

Measure = 
VAR CY = TOTALYTD([Amount],Dato[Date])
VAR LCY = CALCULATE([Amount],SAMEPERIODLASTYEAR(Dato[Date]))

return DIVIDE((cy-lcy),lcy)

PurpleGate_0-1716382704067.png

 

 

No, i want to calculate current period sales by Comapring last year same month sales date

as last year store was runinng for 9 days & cuurent year it's 19 days then calculate current period sales till 9 day only 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors