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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi All
@Vera_33 share with me below expression working fine , in order to return Qty for Jan - Mar 2021 , user need to manually tick on year=2021 , month =3 :-
Solved! Go to Solution.
@admin11 ,
Try like (small change in YTD and LYTD)
YTD=
var _min = date(year(today()),1,1)
var _day = today()
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year] =year(Today()) && 'Date'[Day of Year] <= _day) )
LYTD =
var _min = date(year(today())-1,1,1)
var _max = date(year(today())-1,month(today()),day(today()))
var _day = datediff(_min, _max,day)+1
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year] = year(Today())-1 && 'Date'[Day of Year] <= _max))
Below is the 2 expression work fine , user don't need to filter year & month :-
Hi Paul,
I actually don't quite understand your question, why you filter the date and the user needs to filter again? Did @amitchandak answer your question?
Below is the 2 expression work fine , user don't need to filter year & month :-
your exxpression below is working fine :-
@admin11 , YTD and LYTD , without use selecting a date
YTD=
var _min = date(year(today()),1,1)
var _day = datediff(_min, today(),day)+1
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year] =year(Today()) && 'Date'[Day of Year] <= _day) )
LYTD =
var _min = date(year(today())-1,1,1)
var _max = date(year(today())-1,month(today()),day(today()))
var _day = datediff(_min, _max,day)+1
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year] = year(Today())-1 && 'Date'[Day of Year] <= _day))
Thank you so much for your sharing. i try to use your expression i get null display.
My PBI file :-
https://www.dropbox.com/s/hh9isfpxb99m5t9/PBT_V2021_353%20LYTD%20COUNT.pbix?dl=0
Paul
@admin11 ,
Try like (small change in YTD and LYTD)
YTD=
var _min = date(year(today()),1,1)
var _day = today()
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year] =year(Today()) && 'Date'[Day of Year] <= _day) )
LYTD =
var _min = date(year(today())-1,1,1)
var _max = date(year(today())-1,month(today()),day(today()))
var _day = datediff(_min, _max,day)+1
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year] = year(Today())-1 && 'Date'[Day of Year] <= _max))