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 / Creating a collection ...
Power Apps
Unanswered

Creating a collection from another collection by selecting the chosen column

(0) ShareShare
ReportReport
Posted on by 50

I have a collection of data called PupilMathData which has lots of columns. I want to create another collection, with two columns from that larger collection so I can chart it. One column needs to be the test name, and I want the user to choose the other column (the one they want to view on the graph) from a dropdown.

 

What I have tried here is to assign the selected value from the dropdown to a variable, and use that variable as the column to add into the new collection called MathChartData,  but I get the error 'Argument DisplayChart is invalid. Expected a text literal' - as the showcolumns function like the columns in quotes. Any ideas on how I can do this?

 

Once these two columns are in a separate collection, I will use that collection for the datasource of the bar chart.

 

Set(DisplayChart,MathChartSelection.SelectedText.Value);
ClearCollect(MathChartData, ShowColumns(PupilMathsData,"Test",DisplayChart))

 

Error2.png

Categories:
  • WarrenBelz Profile Picture
    156,752 Most Valuable Professional on at

    Hi @mrwilliams ,

    When you use ShowColumns, you need the actual column name in Quotes. What are the options selected from the drop-down ?

  • mrwilliams Profile Picture
    50 on at

    Hi @WarrenBelz ,

     

    The drop down list contains the names of the columns in the master collection - which are also the same as the datatable which is pulling its data from this collection too.

     

    The drop down coloumn items:
    Dropdown2.png

     

    Then PupilMathData collection:

    collection2.png

    The items in the dropdwon are the same as the dable headings:

    dropdown.png

    Does that help?

  • WarrenBelz Profile Picture
    156,752 Most Valuable Professional on at

    @mrwilliams ,

    Unfortunately, you cannot reference a column name dynamically like that.

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard