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 / Parse a label value to...
Power Apps
Unanswered

Parse a label value to dynamically link to a columnheader in a second table to fetch data from a record

(0) ShareShare
ReportReport
Posted on by 7

Hi all,

 

I have a problem to pass a label value to a formula which should fetch data from a table.

I am a beginner with this, I have watched most videos of Shane Young on Youtube already, but I might have missed the solution.

 

I have 2 data tables which come from Excel (although I have also used a collection of this):

First table is about maximum capacity of an office (named OfficeCapacity).

Office                 OfficeName       MaxCapacity  __PowerAppsId__

OfficeAOffice A22snEyZtrOUIE
OfficeBOffice B19WUOwbNaZ8XY
OfficeCOffice C13EpvrPLaARk0
OfficeDOffice D8socqZWa5d2M

 

Second table: This is a time table mentioning occupancies of these offices (named  MonthlyData)

MonthColumn           OfficeA           OfficeB  OfficeC       OfficeD     __PowerAppsId__

01/01/2020 23:0010986RWEpesdUZ_8
01/03/2020 23:00111210591HFLnvikDA
01/05/2020 22:001210105_uqSaDZBCOE
01/04/2020 22:00105114rkzX-jn_F8o

 

In a vertical gallery I have mentioned

OfficeName (Label4) and MaxCapacity (Label5)  - and this works for those 4 offices (linked to 

Now I would like to add extra labels in each card which the latest occupancy is mentioned. Therefore I would like to link the already present labels to the query I make for the second table:

 

I used following expression to populate Label6 at the text-value:

First(SortByColumns(MonthlyData,"MonthColumn",Descending)).OfficeA

This works and it shows the right number

Naturally I get this same result in all 4 datacards, which is not how I would want it.

I would like to have this dynamic, depending on the current item in this datacard

 

When I try the expression:

First(SortByColumns(MonthlyData,"MonthColumn",Descending)).Label4 - it doesn't work

Neither does

First(SortByColumns(MonthlyData,"MonthColumn",Descending)).Text(Label4)

Neither does

First(SortByColumns(MonthlyData,"MonthColumn",Descending)).ThisItem

Neither does 

First(SortByColumns(MonthlyData,"MonthColumn",Descending)).ThisItem.Office

 

The solution is probably easy, but I am really stuck here.

 

Thanks for helping me out.

Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @PetervanLonden 

    You are making it difficult for yourself because your tables are not properly designed.  It seem seems to me that you have a one to many relationships between Offices and Occupancy.  I would view the design as follows:  Once the data is organized in this way, it becomes easier to design your app.  You need to add an ID column to each table so that the relationship can be used to retrieve the data you want. This design lends itself to future extension in the case that you open more offices or have shorter or longer periods for occupancy. 
    Annotation 2020-05-02 124805.png

  • PetervanLonden Profile Picture
    7 on at

    @Drrickryp Thanks for your reply.

    It was easier to input data that way. But I will try your proposed way and start over. The more you do it, the better you learn.

     

    Out of further interest. Would there be a way to dynamically pass a label value in above formula? - a fixed value works, but is no solution and I can imagine working with cards in a gallery is by nature dynamic. From Vue.JS there is the concept of binding dynamically, just wondered is this is also possible with PowerApps.

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 350 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 318

#3
Mohsin Ali Profile Picture

Mohsin Ali 220

Last 30 days Overall leaderboard