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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Using Date as VAR and Parameter Advanced Editor

Hi, I am trying to use the Var I have set for Startdate and Endate to set the parameter for my dataset from Parquet.

The value for StartofPeriodx = 1/01/2022 12:00:00 PM

The value for EndofPeriodx = 2022-02-08T23:59:59.9999999

I have currently used manual dates, how do I set the [Notification Date] >=StartDate and [Notification Date] <=EndDate

The start of my code is as follows:

 

Let

StartDate = StartOfPeriodx,
EndDate = EndOfPeriodx,
Source = Parquet.Document(File.Contents("\\notifs.pq")),
#"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each [Notification date] >= #datetime(2022, 1, 1, 0, 0, 0) and [Notification date] <= #datetime(2022, 2, 2, 0, 0, 0))

 

Thanks for the help.

1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User


@Anonymous wrote:

 

I have currently used manual dates, how do I set the [Notification Date] >=StartDate and [Notification Date] <=EndDate

 


As long as the variables are the same data type if should work exactly as you have it in your psuedo code.

 

eg.

Let

StartDate = StartOfPeriodx,
EndDate = EndOfPeriodx,
Source = Parquet.Document(File.Contents("\\notifs.pq")),
#"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each [Notification date] >= StartDate and [Notification date] <= EndDate)

 

 

View solution in original post

4 REPLIES 4
d_gosbell
Super User
Super User


@Anonymous wrote:

 

I have currently used manual dates, how do I set the [Notification Date] >=StartDate and [Notification Date] <=EndDate

 


As long as the variables are the same data type if should work exactly as you have it in your psuedo code.

 

eg.

Let

StartDate = StartOfPeriodx,
EndDate = EndOfPeriodx,
Source = Parquet.Document(File.Contents("\\notifs.pq")),
#"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each [Notification date] >= StartDate and [Notification date] <= EndDate)

 

 

Anonymous
Not applicable

Yeah I guess it is a date format issue then.

I believe it's only the EndDate giving me an error.

I got the following for the EndofPeriod

 

Source = if EndOfPeriod = null then Date.AddDays(Date.EndOfDay(DateTime.LocalNow()),-1) else EndOfPeriod
 the above gives me a format of 2022-02-09T23:59:59.9999999, how can I change it to 1/01/2022 12:00:00 PM format?


@Anonymous wrote:

Yeah I guess it is a date format issue then.

 


No, I was talking about Data Types (eg. Date vs DateTime vs DateTimeOffset), but it looks like you are using a DateTime here so that is probably not the issue. (although DateTime.LocalNow could be a problem depending on where you run your data refresh from. If you refresh on the Power BI Service the Date Time will be in UTC time, if you refresh on a Report Server the time will depend on the timezone setting on the server)

 


@Anonymous wrote:

I believe it's only the EndDate giving me an error.

This is the first time you've mentioned seeing an error. What is the text of the error message?

 

Anonymous
Not applicable

Cheers mate, The previous way worked. It kept getting timed out as the date range was over a year.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.