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
Anonymous
Not applicable

M Language Error, Need Help finding what's wrong

Any help is appreciated. The Token Literal Expected error message is underlining the "in" line. 

Screenshot 2021-06-07 132901.png

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Try replacing the last M codes with below codes. You need to give a name to the last step. Here I name it as #"Filtered Rows 2", you can use any name which hasn't been used in previous steps. And no comma at the end of the last step. Also put the name of last step after "in", then it will return the result of the last step. 

#"Removed Duplicates" = Table.Distinct(#"Clear null",{"DATE"}),
#"Filtered Rows 2" = Table.SelectRows(#"Removed Duplicates", each [DATE] >= List.Min(#"Removed Duplicates"[DATE]) and [DATE] <= Date.AddYears(List.Min(#"Removed Duplicates"[DATE]),5))
in
#"Filtered Rows 2"

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Anonymous
Not applicable

Agreed, you need to remove the comma before "in", but you also need to name your last Table.SelectRows statement, like ThisStep = Table.SelectRows(etc.)

in

ThisStep

 

--Nate

Watsky
Solution Sage
Solution Sage

Hey @Anonymous 

 

Looks like your last line of code before the in statement has a comma at the end. Remove the comma. Also, the entire last statement. 

 

Watsky_0-1623096373520.png

 

Not sure if it'll work that way you may need to change the comma you have seperating the two functions with an and like this:

 

#"Removed Duplicates" =
Table.Distinct(#"Clear null",{"DATE"}) and
Table.SelectRows(#"Filtered Rows", each [DATE] >= List.Min(#"Filtered Rows"[DATE]) and [DATE]<= Date.AddYears(List.Min(#"Filtered Rows"[DATE], 5)))
in
#"Removed Duplicates"



Did my answer(s) help you? Give it a kudos by clicking the Thumbs Up! ?
Did my post answer your question(s)? Mark my post as a solution. This will help others find the solution.


Did my answer(s) help you? Give it a kudos by clicking the Thumbs Up!
Did my post answer your question(s)? Mark my post as a solution. This will help others find the solution.

Proud to be a Super User!

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.