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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DIACHROMA
Helper II
Helper II

DAX Time Intelligence based on current date ignoring date slicers

Hi!

 

I had trouble with some metrics to calculate my sales across multiple time periods which will be calculated based on the current date, disregarding date filters.

 

I would like to be able to filter my [Sales Amount] measure according to the predefined periods below:

 

Last month
Past year
YTD
P3M
P6M
P12M

 

Without having to manually select the months in a slicer.


The idea is that users don't need to update the slicer month every month.

 

How can I do ?

 

Thank you in advance for your help!

 

Pauline

2 ACCEPTED SOLUTIONS
littlemojopuppy
Community Champion
Community Champion

Hi @DIACHROMA 

 

Try these out 🙂

Last Month = 
CALCULATE(
	[Sales Amount],
	PREVIOUSMONTH('Date'[Date])
)

Past Year =
CALCULATE(
	[Sales Amount],
	PREVIOUSYEAR('Date'[Date])
)

YTD =
TOTALYTD(
	[Sales Amount],
	'Date'[Date]
)

P3M =
CALCULATE(
	[Sales Amount],
	DATESINPERIOD(
		'Date'[Date],
		EOMONTH(TODAY(), -1),
		-3,
		MONTH
	)
)

P6M =
CALCULATE(
	[Sales Amount],
	DATESINPERIOD(
		'Date'[Date],
		EOMONTH(TODAY(), -1),
		-6,
		MONTH
	)
)

P12M =
CALCULATE(
	[Sales Amount],
	DATESINPERIOD(
		'Date'[Date],
		EOMONTH(TODAY(), -1),
		-12,
		MONTH
	)
)

This assumes you have a date table named "Date" and the date field in it is named "Date"

 

Hope this helps!  🙂

View solution in original post

amitchandak
Super User
Super User

@DIACHROMA , To answer your question without selecting a month in slicer.

You have two approches

1. You date table should end at max date of you fact or Today //Calendar/date table is must for time intelligence  -

example : calendar(date(2017,01,01), today())

or

calendar(date(2017,01,01), Max(Table[Date]))

 

Also dicussed same in deatils Why TI fails - https://www.youtube.com/watch?v=OBf0rjpp5Hw

Or you create a column  (one of two and select this month or current month and save that  -https://www.youtube.com/watch?v=hfn05preQYA

 

Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
eomonth([Date],0)= eomonth(Today(),0),"This Month" ,
Format([Date],"MMM-YYYY")
)

Month Type = Switch( True(),
eomonth([Date],0)= eomonth(Today(),0),"Current Month" ,
Format([Date],"MMM-YYYY")
)

 

 

Formula you can check in last reply

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

@DIACHROMA , To answer your question without selecting a month in slicer.

You have two approches

1. You date table should end at max date of you fact or Today //Calendar/date table is must for time intelligence  -

example : calendar(date(2017,01,01), today())

or

calendar(date(2017,01,01), Max(Table[Date]))

 

Also dicussed same in deatils Why TI fails - https://www.youtube.com/watch?v=OBf0rjpp5Hw

Or you create a column  (one of two and select this month or current month and save that  -https://www.youtube.com/watch?v=hfn05preQYA

 

Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
eomonth([Date],0)= eomonth(Today(),0),"This Month" ,
Format([Date],"MMM-YYYY")
)

Month Type = Switch( True(),
eomonth([Date],0)= eomonth(Today(),0),"Current Month" ,
Format([Date],"MMM-YYYY")
)

 

 

Formula you can check in last reply

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@DIACHROMA The sad truth is that @amitchandak employs a bot to respond to people asking questions.  Almost random answers based on keywords in your question.  I don't...I actually try to help people instead of padding stats.

 

I offered solutions that I think will work (despite the limited info provided).  If they don't, will work to figure them out.

@littlemojopuppy , I have carefully, replied to portion you have not answered. Please check Even I refer to last post "Formula you can check in last reply"

 

@DIACHROMA , I only replied for Selection issue. "

Without having to manually select the months in a slicer.


The idea is that users don't need to update the slicer month every month.

"

 

Please carefully read what I replied.  There is not overplap with your answer. There is no BOT here.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak you have carefully, replied to nothing.  You offer nothing new to solutions and just try to poach stats.

@littlemojopuppy , I disagree.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Of course 🙄

littlemojopuppy
Community Champion
Community Champion

Hi @DIACHROMA 

 

Try these out 🙂

Last Month = 
CALCULATE(
	[Sales Amount],
	PREVIOUSMONTH('Date'[Date])
)

Past Year =
CALCULATE(
	[Sales Amount],
	PREVIOUSYEAR('Date'[Date])
)

YTD =
TOTALYTD(
	[Sales Amount],
	'Date'[Date]
)

P3M =
CALCULATE(
	[Sales Amount],
	DATESINPERIOD(
		'Date'[Date],
		EOMONTH(TODAY(), -1),
		-3,
		MONTH
	)
)

P6M =
CALCULATE(
	[Sales Amount],
	DATESINPERIOD(
		'Date'[Date],
		EOMONTH(TODAY(), -1),
		-6,
		MONTH
	)
)

P12M =
CALCULATE(
	[Sales Amount],
	DATESINPERIOD(
		'Date'[Date],
		EOMONTH(TODAY(), -1),
		-12,
		MONTH
	)
)

This assumes you have a date table named "Date" and the date field in it is named "Date"

 

Hope this helps!  🙂

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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