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
moba
New Member

Token RightParent expected error

hi when i try to use create this function i get Token RightParent expected error in the “Filtered Rows” line and the issue is with the numbers. Anny idea why ?

Thank you
(StartDate as date, EndDate as date) as number =>
let
Source =
(if StartDate <= EndDate then
List.Dates(StartDate,
Duration.Days(EndDate-StartDate)+1,
Duration.From(1))
else
List.Dates(EndDate,
Duration.Days(StartDate-EndDate)+1,
Duration.From(1))
),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Inserted Day of Week" = Table.AddColumn(#"Converted to Table", "Day of Week", each Date.DayOfWeek([Column1], Day.Monday), Int64.Type),
#"Filtered Rows" = Table.SelectRows(#"Inserted Day of Week", each ([Day of Week] 5 and [Day of Week] 6)),
Custom1 = if StartDate <= EndDate then Table.RowCount(#"Filtered Rows") else Table.RowCount(#"Filtered Rows") * (-1)
in
Custom1

 

This e-mail is confidential and it is intended only for the addressees. Any review, dissemination, distribution, or copying of this message by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error, kindly notify us immediately by telephone or e-mail and delete the message from your system. The sender does not accept liability for any errors or omissions in the contents of this message which may arise as a result of the e-mail transmission.

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @moba 

Change the code below, it would work.

#"Filtered Rows" = Table.SelectRows(#"Inserted Day of Week", each ([Day of Week]= 5 and [Day of Week] =6))

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @moba 

Change the code below, it would work.

#"Filtered Rows" = Table.SelectRows(#"Inserted Day of Week", each ([Day of Week]= 5 and [Day of Week] =6))

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

Top Solution Authors