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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (58,272)