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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have sales data that goes through December 21st 2021 I also have last year's sales data through December 21st 2020. Note that I blanked out all data past todays (12/21) date as I want to compare apples to apples. The table looks fine and I have last year's sales by month (November last full month) and December is showing day data to the 20th. I would like to have a bar chart showing all the completed months and the month to date for December in the same bar chart. Right now my last bar on chart is November as it is the last complete month. Any way to force power bi visualization to include December month to date and add up this year vs last year through the 20th?
Hi @Anonymous
Try these measures
Sales TY = CALCULATE(SUM('Table'[Sales]),Dates[Year]=YEAR(TODAY()))Sales LY =
VAR _month = SELECTEDVALUE(Dates[Month])
RETURN
CALCULATE(SUM('Table'[Sales]),ALL(Dates),Dates[Year]=YEAR(TODAY())-1,Dates[Month]=_month,Dates[Date]<=EDATE(TODAY(),-12))
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
@Anonymous , Try datesytd with additional filter
YTD QTY forced=
var _max1 = today() //or maxx(allselected('Order'),'order'[Date])
var _max = format(_max,"MMDD")
return
calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),filter('Date', format('Date'[Date],"MMDD")<=_max))
YTD QTY forced=
var _max = today()//or maxx(allselected('Order'),'order'[Date])
return
if(max('Date'[Date])<=_max, calculate(Sum('order'[Qty]),DATESYTD('Date'[Date])), blank())
//or
//calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),filter('Date','Date'[Date]<=_max))
//calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<=_max))
LYTD QTY forced=
var _today = maxx(allselected('Order'),'order'[Date])
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)
Alternate options in comments
Thanks for getting back to me. I appreciate it. I tried to create a measure utilizing the above with no luck. I am certain it is because I don't fundamentally understand it.
My current measure is
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!