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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
andi2333
Helper I
Helper I

Cannot convert the value #date to type List

Hello,

I have a simple question for a simple query.

I would like to introduce a custom column B which shows "true" or "false" if the date in column A is the maximal value (aka newest date) available.

 

My query: 

if List.Max([Real Date])=[Real Date] then "TRUE" else "FALSE"

Howver, PQ tells me that "We cannot convert the value #date(2024, 1, 1) to type List.".

Still a bit new to PQ, but I figure this should be super simple to solve?

 

Thanks in advance.

2 ACCEPTED SOLUTIONS
BA_Pete
Super User
Super User

Hi @andi2333 ,

 

You're trying to evaluate the current row in a list context as you're applying your calculation to the current table (query step).

Try moving the max evaluation to the previous table/query step:

 

if List.Max([Real Date])=[Real Date] then "TRUE" else "FALSE"

// goes to:

if List.Max( PreviousStepName[Real Date]) = [Real Date] then "TRUE" else "FALSE"

 

You can actually simplify further by just using a logical expression:

 

List.Max( PreviousStepName[Real Date]) = [Real Date]

 

*BUMP* Repost as original apparently wasn't showing up.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

Omid_Motamedise
Memorable Member
Memorable Member

in the case of using 

if List.Max([Real Date])=[Real Date] then "TRUE" else "FALSE"

the value of [Real Date] is not a list and is just a value in type date, if you want to refer to the whole column, you have to mention the name of previous step befor the name of column,

 

if the previous step is Source, rewrite the formula as 

List.Max(Source[Real Date])=[Real Date]

View solution in original post

2 REPLIES 2
Omid_Motamedise
Memorable Member
Memorable Member

in the case of using 

if List.Max([Real Date])=[Real Date] then "TRUE" else "FALSE"

the value of [Real Date] is not a list and is just a value in type date, if you want to refer to the whole column, you have to mention the name of previous step befor the name of column,

 

if the previous step is Source, rewrite the formula as 

List.Max(Source[Real Date])=[Real Date]

BA_Pete
Super User
Super User

Hi @andi2333 ,

 

You're trying to evaluate the current row in a list context as you're applying your calculation to the current table (query step).

Try moving the max evaluation to the previous table/query step:

 

if List.Max([Real Date])=[Real Date] then "TRUE" else "FALSE"

// goes to:

if List.Max( PreviousStepName[Real Date]) = [Real Date] then "TRUE" else "FALSE"

 

You can actually simplify further by just using a logical expression:

 

List.Max( PreviousStepName[Real Date]) = [Real Date]

 

*BUMP* Repost as original apparently wasn't showing up.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.