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.
I want to compare sales current year with last year for each specific store, if value last year for that specific store wasn't null.
For example, if store X on 10 week of 2018 had 0 sales, then don't summarize sales for store X on 10 week of 2019.
I want to separate new stores in current year from old ones by weeks.
At first I need to summarize sales by weeks in 2018 for each store and then compare with sales in 2019.
I tried to get a result using a new table, but in that case I lost the ability to sort sales by date. Can this be done with measures?
Please help me how to do it right?
Table = FILTER(
ADDCOLUMNS(
CROSSJOIN(
DISTINCT('Calendar'[Weeknumber]);
DISTINCT(Sales[Shop]));
"sum2018"; CALCULATE(SUM(Sales[sum]); 'Calendar'[Year] = 2018);
"sum2019"; CALCULATE(SUM(Sales[sum]); 'Calendar'[Year] = 2019));
[sum2018] <> 0)
Solved! Go to Solution.
Hello @RomanSk
Add this measure in which will respect the store / week pairs.
Next Year filtered context = SUMX ( SUMMARIZE( sales, Dates[Week], sales[Store] ), [Next Year Filtered] )
@Hello @RomanSk
\You should be able to just apply a filter in your calculation of next year so, with these you would select 2018 and the [Next Year Filtered] would be showing 2019.
Amount = SUM ( sales[Sales] )
Next Year Filtered = IF ( NOT ISBLANK ( [Amount] ), CALCULATE([Amount],DATEADD(Dates[Date],+1,year)))
I uploaded a sample file here for you to take a look at. https://www.dropbox.com/s/egy58koo7ho9s91/FilteredNextYear.pbix?dl=0
Thanks for the answer, but here we have a filter context and the totals in measure "Next Year Filtered" are wrong.
Hello @RomanSk
Add this measure in which will respect the store / week pairs.
Next Year filtered context = SUMX ( SUMMARIZE( sales, Dates[Week], sales[Store] ), [Next Year Filtered] )
Thank you very much
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 |
---|---|
96 | |
92 | |
81 | |
70 | |
64 |
User | Count |
---|---|
115 | |
106 | |
96 | |
81 | |
72 |