Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
11 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
6 | |
6 |