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 / If 'Calendar.Category'...
Power Apps
Answered

If 'Calendar.Category' text is the same as 'Table2.Category' text return 'Table2.Question'

(0) ShareShare
ReportReport
Posted on by 41

Hello,

 

I have two data sources, Galley1 which is a Calendar (SharePoint List) & Table2 (Excel Table).

 

I'm trying to return a value if "ThisItem.Category = the same as Table2.Category, the return Table2.Question"

 

For example:

 

Calendar Data SourceTable2 Data SourceTablet2 Question
Category: HRCategory: HR"Are they working?"
Category AccountingCategory Accounting"Are they good at maths"

 

So if my gallery category is HR then it will return "Are they working?" in a text field.

 

Sorry for my bad explanation.

Many thanks,

Kyle

Categories:
I have the same question (0)
  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Is there anyway you could set a variable?

    So if Table2 was loaded onVisible you could Set(var_checkcategory, Table2.Category) 

     

    Hope this helps.

  • KyleJackDaniel1 Profile Picture
    41 on at

    I've tried playing round with setting variable however cant get it to work.

    I believe the formula needs to be something like,

    If(
    ThisItem.Category.Value=Tablet2.'Category Name',Table2.Question
    )

     But obviously need to filter the Table2 to only show the matching name and return the Question next to the matching name.

  • KyleJackDaniel1 Profile Picture
    41 on at

    I can get it partly to work with having Table2 in a Gallery and the referencing the selected item of that gallery.

    If(ThisItem.Category.Value=Gallery5.Selected.'Category Name',Gallery5.Selected.Question)

    But obviously that only displays the question if Gallery5 is selected and only returns if it matches the selection.

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Right and you want your calendar gallery to know how to respond based on Table2. What if you used ClearCollect in your OnStart for the Table?

    You could then reference the collection?

     

    You could almost just use an IF statement for your calendar and then the label for question you could put

    If(
    ThisItem.Category.Value="Category1",
    "question1",
    ThisItem.Category.Value="Category2",
    "question2",
    )

     

  • KyleJackDaniel1 Profile Picture
    41 on at

    I don't think that'll work as Table2 gets updated a lot with different things, so id have to manually enter all category types and questions.

  • Verified answer
    KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Ok, so 

    ClearCollect(collectionTable, Table2)

    then on that label in the gallery

    LookUp(
     collectionTable,
     ThisItem.Category = 'Category',
     Question
    )
  • KyleJackDaniel1 Profile Picture
    41 on at

    Perfect, that has worked. That's very simple and something I completely missed. I was diving too deep down the 'If' statements and lost my way. 

    Thank you @KRider .

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Yeah man, no problem at all. I have done that many times myself, thinking complicated when the short easy answer was in front of my eyes.

     

    Brainstorming can be a very powerful ally 😄 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 476

#2
WarrenBelz Profile Picture

WarrenBelz 365 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 339

Last 30 days Overall leaderboard