Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
If today is November 4 i want to calculate some measures as below requirement
1. sum(sales) between October 1 to October 4 (i.e last 1 month same period)
i tried this measure but giving the result from Oct 1 to Oct 3 but i want from oct 1 to oct 4th.
1-MonthSamePeriod =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER (
'Table',
AND (
[Date]
>= DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 1 ),
[Date]
<= DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, DAY ( TODAY () ) - 1 )
)
)
)
Solved! Go to Solution.
Hi @yalla ,
Since you want to caulate 10-1 to 10-4 in this case based on 11-4, why did you use -1 in Day()?
Just delete -1 in the formula and it should work.
1-MonthSamePeriod =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER (
'Table',
AND (
[Date]
>= DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 1 ),
[Date]
<= DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, DAY ( TODAY () ) )
)
)
)
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@yalla , Try like examples
Last MTD QTY forced=
var _max = date(year(today()),month(today())-1,day(today()))
return
CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
or
Last MTD QTY forced=
var _max = date(year(today()),month(today())-1,day(today()))
return
if('Date'[Date]<=_max , CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year))), blank())
in if condition is not able to pick date column.do we have other measure
Hi @yalla ,
Since you want to caulate 10-1 to 10-4 in this case based on 11-4, why did you use -1 in Day()?
Just delete -1 in the formula and it should work.
1-MonthSamePeriod =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER (
'Table',
AND (
[Date]
>= DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 1 ),
[Date]
<= DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, DAY ( TODAY () ) )
)
)
)
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.