Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet 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
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.
Solved! Go to Solution.
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
Proud to be a Datanaut!
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]
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]
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
Proud to be a Datanaut!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
32 | |
16 | |
12 | |
10 | |
9 |
User | Count |
---|---|
44 | |
24 | |
20 | |
14 | |
13 |