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
ansar
Helper II
Helper II

To add max date from a table to date table

Hi ,

 

Can any one help here to update the coding in advance editor.

Source = 01/08/2019
add dates until today = List.Dates(Source, Number.From(DateTime.LocalNow())+1- Number.From(Source), #duration(1,0,0,0))

I have a fact table Data in that a column contains date [Pstng Date], i want my calander table always take the max date from Data[Pstng Date] not current date.



 

ansar_0-1631087006246.png

Regards,

Ansar.

2 ACCEPTED SOLUTIONS
yaak
Helper I
Helper I

Ansar,

 

You can use: List.Max(Data[Pstng Date])

If you want to have a list of dates from tha maximum [Pstng Date] date until today you can use:

let
    Source = List.Max(Data[Pstng Date]),
    AddDates = List.Dates(Source, Number.From(DateTime.LocalNow())+1- Number.From(Source), #duration(1,0,0,0))
in
    AddDates

 You can minimise it to a single line like this: 

Source = List.Dates(List.Max(Data[Pstng Date]), Number.From(DateTime.LocalNow())+1- Number.From(List.Max(Data[Pstng Date])), #duration(1,0,0,0))

If you want to create list of dates from some 'fixed' date (or linked to some other parameter) until the maximum date in [Pstng Date] column, then you can use this:

let
    Source = Date.From("01/01/2020"),
    AddDates = List.Dates(Source, Number.From(List.Max(Data[Pstng Date]))+1- Number.From(Source), #duration(1,0,0,0))
in
    AddDates

 

I hope that helps,

 

Piotr

View solution in original post

 

@yaak Thanks Dear !! below is what exactly required.

let
    Source = Date.From("01/01/2020"),
    AddDates = List.Dates(Source, Number.From(List.Max(Data[Pstng Date]))+1- Number.From(Source), #duration(1,0,0,0))
in
    AddDates

Regards,

Ansar. 

View solution in original post

2 REPLIES 2
yaak
Helper I
Helper I

Ansar,

 

You can use: List.Max(Data[Pstng Date])

If you want to have a list of dates from tha maximum [Pstng Date] date until today you can use:

let
    Source = List.Max(Data[Pstng Date]),
    AddDates = List.Dates(Source, Number.From(DateTime.LocalNow())+1- Number.From(Source), #duration(1,0,0,0))
in
    AddDates

 You can minimise it to a single line like this: 

Source = List.Dates(List.Max(Data[Pstng Date]), Number.From(DateTime.LocalNow())+1- Number.From(List.Max(Data[Pstng Date])), #duration(1,0,0,0))

If you want to create list of dates from some 'fixed' date (or linked to some other parameter) until the maximum date in [Pstng Date] column, then you can use this:

let
    Source = Date.From("01/01/2020"),
    AddDates = List.Dates(Source, Number.From(List.Max(Data[Pstng Date]))+1- Number.From(Source), #duration(1,0,0,0))
in
    AddDates

 

I hope that helps,

 

Piotr

 

@yaak Thanks Dear !! below is what exactly required.

let
    Source = Date.From("01/01/2020"),
    AddDates = List.Dates(Source, Number.From(List.Max(Data[Pstng Date]))+1- Number.From(Source), #duration(1,0,0,0))
in
    AddDates

Regards,

Ansar. 

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
Top Kudoed Authors