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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
KyleD87
New Member

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 @KyleD87 

 

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 @KyleD87 

 

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
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors