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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Invalid argument type ...
Power Apps
Answered

Invalid argument type after filter?

(0) ShareShare
ReportReport
Posted on by 482

Dear all

 

The following formula works great as long as my source in the ForAll loop isn't filtered. 

 

 

// fill invoice items
ForAll(
 'Time Trackings',
 Collect(
 colActiveInvoice,
 {
 Name: Comments,
 'Invoice Number': gblSelectedInvoice.crc06_invoicenumber,
 Rate: 
 If(
 drpChooseProjects.Selected.'Is Fixed Rate',
 drpChooseProjects.Selected.'Fixed Rate',
 LookUp(Users, User = 'Time Trackings'[@User].User, 'Billable Rate')
 ),
 User: User.User,
 Qty: Hours,
 'Line Total': 
 If(
 drpChooseProjects.Selected.'Is Fixed Rate',
 drpChooseProjects.Selected.'Fixed Rate',
 LookUp(Users, User = 'Time Trackings'[@User].User, 'Billable Rate')
 )
 * Hours
 }
 )
);

 

 

 

However, once it's filtered, like so:

 

 

// fill invoice items
ForAll(
 Filter(
 'Time Trackings',
 Billed = 'Billed (Time Trackings)'.No &&
 Project.Project = drpChooseProjects.Selected.Project &&
 Date > dteStartChooseProjects.SelectedDate && Date < dteEndChooseProjects.SelectedDate 
 ),
 Collect(
 colActiveInvoice,
 {
 Name: Comments,
 'Invoice Number': gblSelectedInvoice.crc06_invoicenumber,
 Rate: 
 If(
 drpChooseProjects.Selected.'Is Fixed Rate',
 drpChooseProjects.Selected.'Fixed Rate',
 LookUp(Users, User = 'Time Trackings'[@User].User, 'Billable Rate')
 ),
 User: User.User,
 Qty: Hours,
 'Line Total': 
 If(
 drpChooseProjects.Selected.'Is Fixed Rate',
 drpChooseProjects.Selected.'Fixed Rate',
 LookUp(Users, User = 'Time Trackings'[@User].User, 'Billable Rate')
 )
 * Hours
 }
 )
);

 

 

 

this bit: LookUp(Users, User = 'Time Trackings'[@User].User, 'Billable Rate') is throwing an error, saying "invalid argument type".

invalid-argument-type.png

 

Does anyone know why?

I can't use the As function either due to this reason (post).

 

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,409 Most Valuable Professional on at

    Hi @mrQ ,

    There is potential ambiguity and also you do not need to repeat 'Time Trackings' when you are inside a ForAll(). The As statement generally solves ambiguity - try this

    ForAll(
     'Time Trackings' As wTime,
     Collect(
     colActiveInvoice,
     {
     Name: Comments,
     'Invoice Number': gblSelectedInvoice.crc06_invoicenumber,
     Rate: 
     If(
     drpChooseProjects.Selected.'Is Fixed Rate',
     drpChooseProjects.Selected.'Fixed Rate',
     LookUp(
     Users, 
     User = wTime.User
     ).'Billable Rate'
     ),
     User: User.User,
     Qty: Hours,
     'Line Total': 
     If(
     drpChooseProjects.Selected.'Is Fixed Rate',
     drpChooseProjects.Selected.'Fixed Rate',
     LookUp(
     Users, 
     User = wTime.User
     ).'Billable Rate'
     )* Hours
     }
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • mrQ Profile Picture
    482 on at

    Hi @WarrenBelz 

    I can't use the As function due to the post linked in my initial post.

     

  • Verified answer
    WarrenBelz Profile Picture
    156,409 Most Valuable Professional on at

    Hi @mrQ ,

    I must admit that is the first time I have seen the As statement fail its intended purpose (and I use it extensively - but on SharePoint), nevertheless another path is With(), which also addresses any Delegation issues

    With(
     {
     wTime:
     Filter(
     'Time Trackings',
     Billed = 'Billed (Time Trackings)'.No &&
     Project.Project = drpChooseProjects.Selected.Project &&
     Date > dteStartChooseProjects.SelectedDate && 
     Date < dteEndChooseProjects.SelectedDate 
     ),
     wFixed:drpChooseProjects.Selected.'Fixed Rate',
     wType:drpChooseProjects.Selected.'Is Fixed Rate',
    	 wUsers:Users
     },
     ForAll(
     wTime,
     With(
     {
     wRate:
     LookUp(
     wUsers, 
     User = wTime.User,
     ).'Billable Rate',
     },
     Collect(
     colActiveInvoice,
     {
     Name: Comments,
     'Invoice Number': gblSelectedInvoice.crc06_invoicenumber,
     Rate: 
     If(
     wType, 
     wFixed, 
     wRate
     ),
     User: User.User,
     Qty: Hours,
     'Line Total': 
     If(
     wType,
     wFixed,
     wRate * Hours
     )
     }
     )
     )
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard