Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
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 .
Solved! Go to Solution.
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.
(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.
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.
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.
(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.
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.
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)
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
User | Count |
---|---|
66 | |
46 | |
20 | |
18 | |
15 |
User | Count |
---|---|
120 | |
41 | |
40 | |
28 | |
23 |