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
AlBud
Frequent Visitor

Custom Column - M formula error

Hi all,

 

I can't quite work out why I'm getting the "Token Equal expected" error.

 

(let PO# = [POnumber] in Table.SelectRows (purchaseDocuments, each [POnumber] = PO#)){0} [amount]

 

The "Merged" table is where I'm creating the the custom column, and I'm trying to get "PO#" to look up the "POnumber" in the "purchaseDocuments" table and return the "amount" value from the "purchaseDocuments" table for the corresponding "PO#" in the "Merged" table.

 

AlBud_0-1660815089770.pngAlBud_1-1660815237523.png

 

1 ACCEPTED SOLUTION

Put following formula in custom column box

= try purchaseDocuments{[POnumber=[#"PO#"]]}[amount] otherwise null

👍 It's been a pleasure to help you | Help Hours: 11 AM to 9 PM (UTC+05:30)

How to get your questions answered quickly -- How to provide sample data

View solution in original post

3 REPLIES 3
Vijay_A_Verma
Super User
Super User

Use this

let 
#"PO#" = [POnumber]
in 
Table.SelectRows (purchaseDocuments, each [POnumber] = #"PO#"){0} [amount]

👍 It's been a pleasure to help you | Help Hours: 11 AM to 9 PM (UTC+05:30)

How to get your questions answered quickly -- How to provide sample data

Hi Vijay,

 

The formula works, but I get an error in the resulting created column. What have I missed?

 

AlBud_0-1660901683245.png

 

The "Merged" table is where I'm creating the the custom column, and I'm trying to get "PO#" to look up the "POnumber" in the "purchaseDocuments" table and return the "amount" value from the "purchaseDocuments" table for the corresponding "PO#" in the "Merged" table.

 

Both tables have been refreshed.

 

Put following formula in custom column box

= try purchaseDocuments{[POnumber=[#"PO#"]]}[amount] otherwise null

👍 It's been a pleasure to help you | Help Hours: 11 AM to 9 PM (UTC+05:30)

How to get your questions answered quickly -- How to provide sample data

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.