Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
DagdasAlbag
Helper I
Helper I

Dax funktcion YTD

Hello,

if i have a slicer like in the picture and filter after 11/19/2010, i want it to be shown every three years like in the filter until 11/19/2010, 11/19/2019 and 11/19/2018. that means december 2019 and 2018 must not be visible anymore. i have crossed it out. i would be happy about an answer!

2020-11-26 16_28_05-000_Schadenanlage_Tagesebene_ProGS_20201118 - Power BI Desktop.png

1 REPLY 1
amitchandak
Super User
Super User

@DagdasAlbag , Try like this with a date table

Plot with year and month from date table you will get YTD for all year

 

YTD Corrected =
var _max = format(today(),"YYYYMM")
return
calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),format('Date'[Date],"YYYYMM")<=_max)

or
YTD Corrected =
var _max = format(today(),"YYYYMM")
return
if(format(max('Date'[Date]),"YYYYMM")<=_max, calculate(Sum('order'[Qty]),DATESYTD('Date'[Date])),blank())

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.