The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I need to calculate sales this year vs same period last year, but my problem is the way data is recorded. For 2021, sales are updated only once a month for previous month and all sales during that month have sales date as the first day of that month. For example, last month data is from February with all sales dates in that month being 2/1/2021. Same situation with sales recorded in 2020, basically we have 12 dates for entire year worth of sales (1/1/2020, 2/1/2020, 3/1/2020, and so on).
I tried using usual TOTALYTD and SAMEPERIODLASTYEAR but they keep giving me entire year worth of data for 2020 and up to date in 2021 since no other sales data is available past 02/2021 yet.
Any idea how I could solve this problem? One thing worth of mentioning is that I do not have date slicers since report is supposed to always show up to date information with same period last year for comparison.
Solved! Go to Solution.
@Anonymous
Try the following formulas:
YTD = CALCULATE(SUM(Table[Amount]),DATESYTD('Calendar'[Date]))
YTD LY = CALCULATE([YTD],SAMEPERIODLASTYEAR('Calendar'[Date]))
YTD LY = CALCULATE ( [YTD], PREVIOUSYEAR ( Calendar[Date] ) )
@Anonymous
Try the following formulas:
YTD = CALCULATE(SUM(Table[Amount]),DATESYTD('Calendar'[Date]))
YTD LY = CALCULATE([YTD],SAMEPERIODLASTYEAR('Calendar'[Date]))
YTD LY = CALCULATE ( [YTD], PREVIOUSYEAR ( Calendar[Date] ) )
I tried these formulas but for some reason I get entire year worth of data, not January and February 2020 vs 2021 but entire 2020 vs whatever I have in 2021.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
79 | |
78 | |
47 | |
39 |
User | Count |
---|---|
147 | |
115 | |
65 | |
64 | |
53 |