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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Applicable88
Impactful Individual
Impactful Individual

Cannot spot Syntax failure/list min query

Hello,

I made a calculated column for this table:

11.05.2021Tuesday11234
12.05.2021Wednesday11235
13.05.2021Thursday11236
14.05.2021Friday11237
15.05.2021Saturaday01238
16.05.2021Sunday01239
17.05.2021Monday0null
18.05.2021Tuesday0null
19.05.2021Wednesday11242
20.05.2021Thursday11243
21.05.2021Friday11244
22.05.2021Saturaday01245
23.05.2021Sunday01246
24.05.2021Monday11247
25.05.2021Tuesday11248
26.05.2021Wednesday11249

 

Whatever day today is I want a calculated column to tell me the next productive workday =1. But only the next one, not further into the future:

Someone helped me a lot and provided me this query, but it might still has a syntax failure in it?

 

NextDay = List.Min(Table.SelectRows(Ordertable, each [ProductiveWorkday] = 1 and [OutBoundDate] > Date.From(DateTime.LocalNow()))[OutBoundDate])

 

I only get a error message.

Thank you very much in advance.

Best. 

 

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

This is a bit of a guess.  Replace 

Ordertable

in the formula with the previous step name  like ......      #"whatever"

View solution in original post

10 REPLIES 10
HotChilli
Super User
Super User

A cyclic reference is when A refers to B which refers to A and so on   or  even A refers to A (refers to A ...)

In Power Query a table is a sequence of query steps so in this case the last query step referred to the table name (which included the last query step) so it was cyclic.

The general advice is that each query step should act on the previous step.  That's not always true but it's a reasonable starting point.

Got it. Thanks for the explanation @HotChilli 

Anonymous
Not applicable

You may wish to wrap each if clause in parentheses so there is not chance of PQ getting confused, like this:

([ProductiveWorkday] = 1) and ([OutboundDate] > Date.From(DateTime.LocalNow()))

 

 

Hi @Anonymous , thanks again for your effort. I also tried to leave the ProductiveWorkday out completely. Didn't help. But I think the tip of @HotChilli is going into the right direction. 

HotChilli
Super User
Super User

This is a bit of a guess.  Replace 

Ordertable

in the formula with the previous step name  like ......      #"whatever"

Hey @HotChilli, thanks so much... this was it!

It was a perfect "guess":)

I really want to learn from this mistake, so can you explain

 why it doesn't work with the orginal table name but with the #"StepName" ?

 

I also want to mention that the ProductiveWorkdays column is originally from a separated mastercalendar

that I joined with the maintable so I can use this as a condition for my statement. I don't know if that plays a role? 

HotChilli
Super User
Super User

what's the error?

no syntax error announced when I input it. but the calculated column state the typical error on every row. so no results. alll the column stated in the function do exist. I clicked on them in the right panel instead of writing myself. 

Click in a cell with the error and it will display under the table.

oh, thank you.

there it is, i translate in english:

Failure in the query 'Ordertable'.Expression.Error: While making the evaluation a cyclical reference where found. 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.