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
pade
Advocate III
Advocate III

Date dimension for last 12 months

Maybe I'm atacking the problem in an incorrect way, please give feadback on that as well

 

I'm trying to make it easy for users of a data set to present diagrams of measures in a variation of date scales. I.E. I would like to make it easy for users to create diagrams that shows the last 6 month of data, the last 12 month of data etc

 

What I did was to create a new Date dimention table (Date Last 12 Months Scale) that users could use as e.g. an X-axis date matrixDate DIM.PNG

The intension is that the users creating reports should be able to use the "Date Last 12 Months Scale" date dimension to create a diagram that always shows the last 12 months (or last 6 month by using an Date Last 6 Months Scale). The date Date dimention I created using: Date 12 months scale = DATESINPERIOD('Date'[Date];TODAY();-12;MONTH)

Diagram.PNG

 

There's some problem with this method. The Date dimension is only freated when the data set is loaded. If I use daily refresh, that would not be a problem though. But the other problem is that the Date Dimension only will contain the days missing in current month. I.E. if I created the new Date table the 20'th of June, the table will only contain dates from the 20'th of July-16 to the 20-th of June-17. This is not correct as I would like to have whole months

 

Anyone that understands what I would like to do and have a good solution?

1 ACCEPTED SOLUTION
Chihiro
Solution Sage
Solution Sage

Try using CALENDAR function with EOMONTH.

 

= CALENDAR(DATE(YEAR(TODAY())-1,MONTH(TODAY())+1,1),EOMONTH(Today(),0))

 

This creates table with dates from 7/1/2016 to 6/30/2017.

View solution in original post

2 REPLIES 2
Chihiro
Solution Sage
Solution Sage

Try using CALENDAR function with EOMONTH.

 

= CALENDAR(DATE(YEAR(TODAY())-1,MONTH(TODAY())+1,1),EOMONTH(Today(),0))

 

This creates table with dates from 7/1/2016 to 6/30/2017.

Thanks a lot @Chihiro.

Although I slightly changed the code to: CALENDAR(DATE(YEAR(TODAY()),MONTH(TODAY())-12,1),EOMONTH(Today(),0))

 

This way it will be easier to change between different periods, and the year will be correct calculated anyway, no matter if I write -24, -12, or -6

 

Best Regards and thanks for supporting //Pär

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.