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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I have a dashboard with a table view that has categories of crime along the left side and columns of totals for YTD figures and Previous YTD figures. On the current year or monthly totals the figures are correct. If it is the first few days in January I get correct numbers for the current month, but on all previous time calculations I get the totals for the entire month and the formulas do not respect the partial days in the current month. For instance,.... if I run the report for the first 5 days in January I would like the previous calculations for the year prior to respect only those first 5 days in January as well. Also I cannot share the model for obvious reasons. Any help would be appreciated.
My YTD DAX:
YTD = CALCULATE(DISTINCTCOUNT(lwmain[lwmainid]),DATESYTD(MasterDate[Date]))
My PYTD DAX:
LYTD = CALCULATE(DISTINCTCOUNT(lwmain[lwmainid]), DATEADD(DATESYTD(MasterDate[Date]),-1,YEAR))
My MTD DAX:
MTD = CALCULATE(DISTINCTCOUNT(lwmain[lwmainid]),DATESMTD(MasterDate[Date]))
My PMTD DAX:
LYMTD = CALCULATE(DISTINCTCOUNT(lwmain[lwmainid]),DATEADD(DATESMTD(MasterDate[Date]), -1,YEAR))
Solved! Go to Solution.
Use of DATESBETWEEN and EDATE functions should resolve this, please check this.
LYMTD = CALCULATE(DISTINCTCOUNT(lwmain[lwmainid]),DATESBETWEEN(MasterDate[Date], EDATE(STARTOFMONTH(MasterDate[Date]),-12),
EDATE(TODAY(),-12)
))
How did you get the status icons for KP_ and K_ columns?
Hi @dkel6177
Please check out the link
If this solves your issue please give KUDOS.
Cheers
CheenuSing
Use of DATESBETWEEN and EDATE functions should resolve this, please check this.
LYMTD = CALCULATE(DISTINCTCOUNT(lwmain[lwmainid]),DATESBETWEEN(MasterDate[Date], EDATE(STARTOFMONTH(MasterDate[Date]),-12),
EDATE(TODAY(),-12)
))
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
8 | |
4 | |
3 |
User | Count |
---|---|
14 | |
13 | |
11 | |
10 | |
10 |