cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
_kikilalaaa
Helper V
Helper V

Filter Function in Gallery + Condition

Hi all.

I have this gallery item and I want to put some calculation into it. But, before that, the item in the gallery should be filtered first based on their level.

 

My filter is like this:

Filter('Student Accommodation',And('Village Block'=varBlock,Level1=varLevel);

 

My calculation is:

 

Filter('Student Accommodation',And('Village Block'=varBlock,Level1=varLevel);
With(
   {
      wMarks:
      LookUp(
          'Student Accommodation',
          'Student Name'= varUserName
      )
   },
AddColumns('Student Accommodation',
"Difference",
Sqrt((wMarks.'Att 1: Cleanliness' - 'Att 1: Cleanliness')^2 + 
(wMarks.'Att 2: Same Course' - 'Att 2: Same Course')^2 +
(wMarks.'Att 3: Same Religion' - 'Att 3: Same Religion')^2 +
(wMarks.'Att 4: Extrovert level'- 'Att 4: Extrovert level')^2 +
(wMarks.'Att 5: Morning Person'- 'Att 5: Morning Person')^2),
"Other Student",
wMarks.'Student Name'
)
)

 

The problem is I could not combine these two. There is error saying "expected operator. we expect an operator such as +.*, or &.

Please help. Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Eelman
Super User
Super User

@_kikilalaaa 

Remove the Filter statement at the start and place it inside your AddColumns instead, like this

 

With(

   {...

   },

AddColumns( Filter('Student Accommodation',And('Village Block'=varBlock,Level1=varLevel), 

"Difference", ...

)

)

 

 

View solution in original post

3 REPLIES 3
Eelman
Super User
Super User

@_kikilalaaa 

Remove the Filter statement at the start and place it inside your AddColumns instead, like this

 

With(

   {...

   },

AddColumns( Filter('Student Accommodation',And('Village Block'=varBlock,Level1=varLevel), 

"Difference", ...

)

)

 

 

View solution in original post

Hi, 
Thank you for helping me! I have tried your solution but it doesn't work out. It said like this. I tried to put filter before "With", but it still doesn't work out.

_kikilalaaa_0-1614358273675.png

 

You are missing a closing bracket for your Filter() statement, just befor  "Difference"

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (41,002)