Flattening a Data source in Power Apps (Data Manipulation)
Andrew Hess Andrew Hess
8.73K subscribers
698 views
36

 Published On Sep 30, 2024

From a user request we are going to flatten out a data source in Power Apps. Formulas are in the description below!

Learn how to flatten a table in Power Apps by transforming multi-choice fields into separate rows for each selection. This quick tutorial will show you how to restructure your data to create a more simplified and accessible format, perfect for reporting and analysis. Whether you're dealing with complex data or looking for ways to improve your app’s efficiency, this video has you covered!

Flatten data source from SharePoint from video:
Clear(colMyCollection);
ForAll(
FlattenMe,
ForAll(
ThisRecord.Details,
Collect(
colMyCollection,
{
ID: ID,
Title: Name,
Manager: Manager,
Details: ThisRecord.Value
}
)
)
)


Collect table formula:
ClearCollect(
colMyNewTable,
Table(
{
ID: 1,
Title: "John Smith",
Manager: "Larry Managers",
Details: "lamp, desk, chair, phone"
},
{
ID: 2,
Title: "Harry Hall",
Manager: "Jane Smith",
Details: "tie, pen"
}
)
)

Flatten comma delimited formula:
Clear(colMyCollection);
ForAll(
colMyNewTable,
ForAll(
Split(ThisRecord.Details,","),
Collect(
colMyCollection,
{
ID: ID,
Title: Title,
Manager: Manager,
Details: ThisRecord.Value
}
)
)
)

Patch flattened tabled formula:
ForAll(colMyCollection,Patch(DetailsSLT,{OriginalID:ID,Title:Title,Manager:Manager,Details:Details}));

Chapters
0:00 Introduction
1:49 Setting up SharePoint
5:35 Viewing Choice field in datatable
10:45 Flatten table with SharePoint
13:20 Patching flattened table
15:36 Flatten Collection
19:20 Using Split

show more

Share/Embed