Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hello guys.
I've been struggling for several hours with this problem.
I have my dataset with sales per day, connected with a calendar table. 30 and 31/1 were nonworking days, so the dates are missing from my Sales table.
Everything works ok for TY, but for the previous year, I can't pick the results I want at the monthly level.
I tried many ways
Below the results and my Calculations:
@amitchandak , unfortunately, it gives the cumulative sales of the entire PY TD and not until the max sales date of the current February.
My problem.. 😑
Thanx
@kostask , That we can limit. you can eomonth on _max to get full Feb last year
LYTD QTY forced=
var _max = date(year(today())-1,month(today()),day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALYTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)
This is so hard 😵
It works and indeed it stops at the end of the month (and not the entire year).
The problem is that firstly it gives results for the full month (we want to stop at the max sales day ), and also cumulatively since day 1 of the year and not the day 1 of the month.
I think the problem is that we work in month context on the table, which must be removed.
Thanx
User | Count |
---|---|
11 | |
9 | |
6 | |
5 | |
4 |