March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I got problem with proper sum of Previous Year up to specific day in current month using time intelligence.
It looks like this:
Actual month is up to 12 day, but previous year shows me sum of whole month, not to this day, it should be 92.
Current dax formula:
Customers Qty MTD PY =
CALCULATE([Customers Qty],
DATESMTD(DATEADD('Calendar'[Date], -1, YEAR))
)
If I filter day 1 to 11 is ok (to 11 day)
I want to have always day slicer in default from 1 to 31. It works fine in other months.
I have a date table marked as date table with date up to max sales date (so 08-12-2022) and its connected to sales fact table by date
I have tried many ways to solve this and none have the desired result, what I'm doing wrong?
Solved! Go to Solution.
@krisstok , seem like GT getting last year full month
try like
LMTD =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _max = date(Year(_max1), month(_max1)-1, day(_max))
var _min = eomonth(_max1,-2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
Comments after return are additional options
LYMTD QTY forced=
var _max = date(year(today())-1,month(today()),day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALMTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)
Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
@krisstok , seem like GT getting last year full month
try like
LMTD =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _max = date(Year(_max1), month(_max1)-1, day(_max))
var _min = eomonth(_max1,-2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
Comments after return are additional options
LYMTD QTY forced=
var _max = date(year(today())-1,month(today()),day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALMTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)
Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
Wow man! It works!
I adapted first formula and now sum is correct. Many thanks! 😄
Customers Qty MTD PY =
VAR _FilteredDate =
IF ( ISFILTERED ( 'Calendar' ), MAX ( 'Calendar'[Date] ), TODAY () )
VAR _max =
DATE ( YEAR ( _FilteredDate ) -1 , MONTH ( _FilteredDate ) , DAY ( _FilteredDate ) )
VAR _min =
EOMONTH ( _max, -1 ) + 1
RETURN
CALCULATE ( [Customers Qty], DATESBETWEEN ( 'Calendar'[Date], _min, _max )
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
15 | |
12 | |
9 | |
8 |
User | Count |
---|---|
41 | |
32 | |
29 | |
12 | |
12 |