web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Custom Formula - Expre...
Power Apps
Unanswered

Custom Formula - Expression.Error - Field Not Found

(0) ShareShare
ReportReport
Posted on by 6
Hi all! I have this code in Power Query to identify if someone was a manager during the month/year that is being evaluated against. I have inserted the Manager Employee Number from the list of available columns. Any ideas on how to fix this?
 
let
    currentEmployee = [Employee Number],
    currentDate = [Effective Date],
    matchingRows = Table.SelectRows(
        Source, 
        (r) => r[#"Manager Employee Number"] = currentEmployee and r[#"Effective Date"] = currentDate
    ),
    count = Table.RowCount(matchingRows)
in
    if count > 0 then 1 else 0
 
 
Categories:
I have the same question (0)
  • SwatiSTW Profile Picture
    741 Super User 2025 Season 2 on at
    1. Confirm that Employee Number and Manager Employee Number are of the same data type (both should be Text or both should be Number). If they are different, you need to convert them
    Table.TransformColumnTypes(Source, {{"Manager Employee Number", type text}, {"Employee Number", type text}})
    Or, if they should be numbers:
    Table.TransformColumnTypes(Source, {{"Manager Employee Number", type number}, {"Employee Number", type number}})
    2. Power Query might not handle exact date-time comparisons properly due to time components. Ensure Effective Date is of type Date in both cases
    Table.TransformColumnTypes(Source, {{"Effective Date", type date}})
    3. The Table.RowCount method can sometimes return unexpected results if filtering does not match properly. Try using List.Count instead
    4. If Manager Employee Number contains spaces or leading/trailing characters, normalize the data
    5. If employee numbers are stored as text and case sensitivity matters, you may want to compare in lowercase
     
    Final optimized query can be 
    let
        currentEmployee = Text.Trim(Text.Lower([Employee Number])),
        currentDate = Date.From([Effective Date]),
        normalizedSource = Table.TransformColumns(Source, {
            {"Manager Employee Number", each Text.Trim(Text.Lower(_)), type text},
            {"Effective Date", Date.From, type date}
        }),
        matchingRows = List.Count(
            Table.SelectRows(normalizedSource, 
                each [#"Manager Employee Number"] = currentEmployee 
                and [#"Effective Date"] = currentDate
            )[Employee Number]
        )
    in
        if matchingRows > 0 then 1 else 0

     
  • LoganK Profile Picture
    6 on at
    Thanks, SwatiSTW! I read through your response and tried to optimize based on your tips then also using your optimized query. Neither worked, but your optimized query got me closer.
     
    This is my new error even though this field is native and comes with the initial dataset/table.
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard