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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Need Solution without slicer values show current year

HAFIZAHMAD_0-1664835839173.png

need this eroor soliution

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , In case of some other year is selected, use all('Date') in place of 'Date'  in filter

 

YTD Today =
var _min = eomonth(today(),-1*month(today()))+1
var _max = today()
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

LYTD Yesterday =
var _today = TODAY()-1
var _max = date(year(_today)-1, month(_today), day(_today))
var _min = eomonth(_max,-1*month(_max))+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

This year Today =
var _min = eomonth(today(),-1*month(today()))+1
var _max = eomonth(_min,11)
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

Last year Today =
var _max = eomonth(today(),-1*month(today()))
var _min = eomonth(_max,-12)+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

https://medium.com/chandakamit/cheat-sheet-power-bi-time-intelligence-formulas-using-today-654f26e27304

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , In case of some other year is selected, use all('Date') in place of 'Date'  in filter

 

YTD Today =
var _min = eomonth(today(),-1*month(today()))+1
var _max = today()
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

LYTD Yesterday =
var _today = TODAY()-1
var _max = date(year(_today)-1, month(_today), day(_today))
var _min = eomonth(_max,-1*month(_max))+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

This year Today =
var _min = eomonth(today(),-1*month(today()))+1
var _max = eomonth(_min,11)
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

Last year Today =
var _max = eomonth(today(),-1*month(today()))
var _min = eomonth(_max,-12)+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

https://medium.com/chandakamit/cheat-sheet-power-bi-time-intelligence-formulas-using-today-654f26e27304

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors