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

Create a dax calendar table that start with today's date and ends with 01/01/2015

Hello Everyone,

 

Can anyone help me with creating a new table that starts with today's date every time I refresh the report.

I want to build this because I don't want unwanted dates starting from tomorrow in the Date slicer and I should be able to use between function within the slicer. 

 

I tried creating a new column with below-given code in a table known as  calendar (generated with calendarauto( ) dax) but then I can't use between a function within the slicer. This code is creating a new column within the calendar table, leaving the date starting from tomorrow as blank. 

 

Dim_Date = IF(
[Date] = Today(),
"Today",
IF(
'Calendar'[Date]=TODAY(),
"Today",
IF(
'Calendar'[Date]<TODAY(),
'Calendar'[Date]&""
))
)
 
Please help!
1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Anonymous 

Bit confusing, you asked for a calendar that starts with today's date but you mean ending with today's date.

Cal = CALENDAR(DATE(2015,1,1), TODAY())

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

4 REPLIES 4
PhilipTreacy
Super User
Super User

Hi @Anonymous 

Bit confusing, you asked for a calendar that starts with today's date but you mean ending with today's date.

Cal = CALENDAR(DATE(2015,1,1), TODAY())

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

Hi @PhilipTreacy 

 

Thank you, Philip. It worked for me.

 

Cheers!

mahoneypat
Employee
Employee

Did you try to use CALENDAR this way instead of CALENDARAUTO?

 

NewDateTable = CALENDAR(TODAY(), DATE(2021,12,31))  // put whatever end date your want or calculate it dynamically from your fact table

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi Pat,

 

I tried the code it didn't work.
I want to create a calendar table which starts 01/01/2015 and ends today.

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.