Search code examples
sharepointpowerapps

How could I add multiple columns at once in PowerApps


Hi I am having the data in sharepoint like

Title ID
S1 101
S1 102
S2 103
S3 104
S3 105

Now I have to create a piechart in PowerApps Showing the Percentage of Each title.

So, I am creating a new column using AddCoulmn(GroupBy,"Title", "Grouped"), "Titles", CountRows(Grouped))

Now I want to create another Column with the distinct titles and its percentage with reference to the ID.

How can I do that?


Solution

  • The AddColumns function can add multiple columns at once. For example, the expression below can be used to add a percentage in addition to the number of titles in the grouping that you have.

    With(
        { totalCount: CountRows(dataSource) },
        AddColumns(
            GroupBy(dataSource, "Title", "Grouped"),
            "Titles", CountRows(Grouped),
            "TitlePercent", 100.0 * CountRows(Grouped) / totalCount))