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 / Dynamic table selectio...
Power Apps
Answered

Dynamic table selection based on department

(0) ShareShare
ReportReport
Posted on by 12

Hello friends,

 

I am a newcomer who is trying to design an app to overview energy consumption of factories. I have three screens which are the main screen, the list view and the details screen. I have achieved to design last to screens but I am stuck on something on the main screen.

 

Right now I have three tables; one for list of users which name, e-mail, and department information, another table for general energy consumption of all factories, and the final one is a summary table which shows average energy consumption etc. The idea is that when someone who works at a specific factory he/she should be able to see his/her consumption data on main screen, likewise when someone on energy department like me launch the app, he/she should see summary table. I have tried to do this with an If case but have failed to do so. I am sharing a screenshot below for better understanding.

 
The if case I am trying to work around is:
 
If(
       dpt="Enerji", // dpt is the text box which gets the user mail and prompts department name
       Özet, // this is the summary table
       dpt="Üretim", // when department is equal to "production" I want to switch to the table below
       Dağılımlar, // this is the consumption table of factories
)
 
dpt is a control type value however "Enerji" or "Üretim" are texts so I know it is not right to equalize
these two values but I do not know how can I both get department name from a table dynamically and compare
this data to select a table.
 

OmerAcil_0-1710484058003.png

 

Thank you in advance,

 

Categories:
  • Verified answer
    mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    hey @OmerAcil 

     

    you can try the follwing approach:

     

    set a global variable (like onvisible of first screen or app onstart):

    Set(userDepartment, Lookup(UsersTable, Email = User().Email).Department)

    For the summary table (let's call it SummaryTable), you could set its Visible property to:

    userDepartment = "Enerji"

     

    For the consumption table (ConsumptionTable), set its Visible property to:

    userDepartment = "Üretim"

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

     

  • OmerAcil Profile Picture
    12 on at

    Hey @mmbr1606 ,

     

    Thank you for your fast response!

     

    I have tried your method but when I set the userDepartment as global variable on App OnStart it comes out as (Text Blank).

    Set(userDepartment, LookUp(Kişiler, Email = User().Email).Departman)

     Do you have any idea why?

  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    hey @OmerAcil 

     

    have you also tried to set the visible property of  the galleries?

  • OmerAcil Profile Picture
    12 on at

    @mmbr1606 

     

    Yes but they came out as blank galleries, I am guessing it is because userDepartment is text blank and it does not match userDepartment with anything else.

  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    it could be the case that the email adress from User().Email and from the table do not match

     

    Verify that User().Email is correctly fetching the email of the current user and that this email exactly matches an email in the Kişiler table. Any discrepancy, such as case sensitivity or extra spaces, could cause the lookup to fail.

     

     

    • First, check if User().Email returns the correct value by temporarily setting it to a label's text and seeing if it displays as expected.
    • Next, verify that the LookUp function can find a record manually by hardcoding a known email address that exists in your Kişiler table and checking if it retrieves the expected department.
    • Ensure there are no delegation warnings with your LookUp formula. PowerApps might have limitations fetching records if your data source is large, and the field you are searching on is not delegable.

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

     

  • OmerAcil Profile Picture
    12 on at

    There are no errors shown on OnStart of App when I use LookUp function but it just outputs a blank text.

     

    • I do not think that the Emails do not match because I am using a LookUp function to prompt the department name under the user picture and name as you can see in the screenshot of my question. However since the textbox that prompts email is control type value I can not match it with a text.
    • I am using my mail as reference which is on the table so since the department prompt works perfectly there should not be a problem with that also.
    • As for the data, it only has 10 rows and 5 columns
  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    Yes you are using a lookup but the user().email has its own value. If u use Test@test.com in your table and the user returns test@test.com its no match cause its key sensitive

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • OmerAcil Profile Picture
    12 on at

    I have found the problem. I was supposed to click on "run on start" option on the app settings. Thus I am accepting your first response as the solution.

     

    Thank you kindly.

  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    Oh yeah that helps a lot hehe sorry forgot to mention 👍

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard