cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LiamR89
Helper I
Helper I

Combining last and filter

 Hi all,

Struggling with an expression, I'm trying to pull in the last (most recent) value for a specific field, into a label.

Datasource is SP

Expression I have is

Last(Filter(GridForecast,StockCode=ThisItem.StockCode&&Title=ThisItem.ProjectID&&PeriodDates=ThisItem.PeriodDates).Qty)

Error is simply - Expected Text Value

Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions
rsaikrishna
Dual Super User
Dual Super User

@LiamR89 

 

Try the following:

 

Text(Last(Filter(GridForecast,StockCode=ThisItem.StockCode&&Title=ThisItem.ProjectID&&PeriodDates=ThisItem.PeriodDates).Qty))

 

Wrapped your formula within Text() function.

 

To test formula, place a label control on the screen and check the following if the above suggestion does not work:

 

Test the value for CountRows(Filter(GridForecast,StockCode=ThisItem.StockCode&&Title=ThisItem.ProjectID&&PeriodDates=ThisItem.PeriodDates).Qty) to see if it returning any values.

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

View solution in original post

3 REPLIES 3
rsaikrishna
Dual Super User
Dual Super User

@LiamR89 

 

Try the following:

 

Text(Last(Filter(GridForecast,StockCode=ThisItem.StockCode&&Title=ThisItem.ProjectID&&PeriodDates=ThisItem.PeriodDates).Qty))

 

Wrapped your formula within Text() function.

 

To test formula, place a label control on the screen and check the following if the above suggestion does not work:

 

Test the value for CountRows(Filter(GridForecast,StockCode=ThisItem.StockCode&&Title=ThisItem.ProjectID&&PeriodDates=ThisItem.PeriodDates).Qty) to see if it returning any values.

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

View solution in original post

Thanks @rsaikrishna 

The first suggestion, wrapping within the text function did not work.

Count rows within my gallery returns 1

CountRows(Filter(GridForecast,StockCode=ThisItem.StockCode&&Title=ThisItem.ProjectID&&PeriodDates=ThisItem.PeriodDates).Qty)

Thank you @rsaikrishna  for connecting with me,

Very simple solution.

For reference for anybody else it was

Last(Filter(GridForecast,StockCode=ThisItem.StockCode&&Title=ThisItem.ProjectID&&PeriodDates=ThisItem.PeriodDates).Qty).Qty

I missed the extra .Qty

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,203)