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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
medwards807
Helper I
Helper I

Need a Date Dimension that does back 9 and 12 months on my Date Table

I have added 2 Calculated Columns on my dates table (date table as a row for each date 1/1/2014 - 12/31/2017)

 

IsLast12Months = IF('Dates'[Date] <= TODAY(),IF('Dates'[Date] >= TODAY()-365,TRUE(),FALSE()),FALSE())

IsLast9Months = IF('Dates'[Date] <= TODAY(),IF('Dates'[Date] >= TODAY()-270,TRUE(),FALSE()),FALSE()),FALSE())

 

This works fine to get be to the exact day from today (i.e. 9 Months 5/15/2016), howewver I need to go back a full 9 months i.e. 5/1/2016.

 

How can I adjust my Dax Calc Columns to capture all days within my 9 month range <?>

 

9 Months:

 

Today = 2/10/2017

 

1 Jan

2 Dev

3 Nov

4 Oct

5 Sep

6 Aug

7 Jul

8 Jun

9 May (5/1/2016)

2 ACCEPTED SOLUTIONS
Phil_Seamark
Microsoft Employee
Microsoft Employee

Try adding this calculated column to your date table.

 

Months From Today = IFERROR(DATEDIFF('Dates'[Date],NOW() , MONTH),-1)

 

This will generate a dynamic column with a number counting it's position to the current month.  Then just set a filter on your Visual, Report or Page to say [Months From Today] between 0 and 9  (or 1 and 9)

 

This will give you every day in the range you require.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

DoubleJ
Solution Supplier
Solution Supplier

I solved a similar scenario with the EOMONTH function which returns the last day of the month of a given date.

 

 

IsWithinLast9Months = IF('Dates'[Date] > EOMONTH(TODAY(),-9),true,false)

 

 

 

Hope this helps.

JJ

 

 

View solution in original post

4 REPLIES 4
DoubleJ
Solution Supplier
Solution Supplier

I solved a similar scenario with the EOMONTH function which returns the last day of the month of a given date.

 

 

IsWithinLast9Months = IF('Dates'[Date] > EOMONTH(TODAY(),-9),true,false)

 

 

 

Hope this helps.

JJ

 

 

Thanks this worked perfect!!!

Phil_Seamark
Microsoft Employee
Microsoft Employee

Try adding this calculated column to your date table.

 

Months From Today = IFERROR(DATEDIFF('Dates'[Date],NOW() , MONTH),-1)

 

This will generate a dynamic column with a number counting it's position to the current month.  Then just set a filter on your Visual, Report or Page to say [Months From Today] between 0 and 9  (or 1 and 9)

 

This will give you every day in the range you require.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thanks Phil - Your solution worked also, great I received 2 different variations that both worked great!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.