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
MikaelB
Frequent Visitor

How to change my code from dynamic start date to fixed date.

Hello.

I have websource, and function that imports currency exchange data and fills daily rates on table with genetated dates. I'm pretty new with PBI, so changing this line below is challenging for me.

Problem: Line below creates dates from current date to -365 days from current date.

Number.From(Date.AddDays(DateTime.Date(DateTime.LocalNow()),-365))..Number.From(DateTime.Date(DateTime.LocalNow()))

 
Question: How to change that line so, that starting date becomes fixed to 01/01/2019.

Thank you 🙂

1 ACCEPTED SOLUTION
MikaelB
Frequent Visitor

Found the answer.

Number.From(#datetime(2019, 1, 1, 0, 0, 0))..Number.From(DateTime.Date(DateTime.LocalNow()))

 

View solution in original post

2 REPLIES 2
MikaelB
Frequent Visitor

Found the answer.

Number.From(#datetime(2019, 1, 1, 0, 0, 0))..Number.From(DateTime.Date(DateTime.LocalNow()))

 

amitchandak
Super User
Super User

@MikaelB , refer the way to create in M. You have the way to start

https://radacad.com/create-a-date-dimension-in-power-bi-in-4-steps-step-1-calendar-columns

https://radacad.com/create-a-date-dimension-in-power-bi-in-4-steps-step-2-fiscal-columns

or the Dax way

1.Creating Financial Calendar - Decoding Date and Calendar 1-5 - Power BI Turning 5 Celebration Series
https://community.powerbi.com/t5/Community-Blog/Creating-Financial-Calendar-Decoding-Date-and-Calend...
2.Any Weekday Week - Decoding Date and Calendar 2-5 - Power BI Turning 5 Celebration Series
https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...

 

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