admin管理员组

文章数量:1134247

Objective: Get the count of rows and Sum of Net Payables per month.

Sample Data:

Net Payables    Date Created
14,523.00       1-Dec-24
34,253.00       2-Dec-24
23,562.00       1-Jan-25
135,664.00      3-Jan-25
1,234,566.00    5-Jan-25

Code so far:

ClearCollect(TempTransCol,'Temp Transaction');
ClearCollect(
    ColGroupedData,
    AddColumns(
        GroupBy(
            TempTransCol,
            Text('Date Created', "mm-yyyy"),
            GroupItem
        ),
        TotalCount,
        CountRows(GroupItem),
        SumNet,
        Sum(GroupItem,'Net Payable')
    )
);

Error Received: Name isn't valid. 'Date Created' isn't recognized.

Objective: Get the count of rows and Sum of Net Payables per month.

Sample Data:

Net Payables    Date Created
14,523.00       1-Dec-24
34,253.00       2-Dec-24
23,562.00       1-Jan-25
135,664.00      3-Jan-25
1,234,566.00    5-Jan-25

Code so far:

ClearCollect(TempTransCol,'Temp Transaction');
ClearCollect(
    ColGroupedData,
    AddColumns(
        GroupBy(
            TempTransCol,
            Text('Date Created', "mm-yyyy"),
            GroupItem
        ),
        TotalCount,
        CountRows(GroupItem),
        SumNet,
        Sum(GroupItem,'Net Payable')
    )
);

Error Received: Name isn't valid. 'Date Created' isn't recognized.

Share Improve this question edited Jan 8 at 1:49 user2328935 asked Jan 8 at 1:38 user2328935user2328935 252 silver badges9 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

In the GroupBy function you cannot use an arbitrary expression (such as Text('Date Created', "mm-yyyy")) in the columns to be grouped. You can fix this by using the AddColumns function to create a new column with that value, like the expression below:

ClearCollect(
    ColGroupedData,
    AddColumns(
        GroupBy(
            AddColumns(TempTransCol, 'DateCreatedMonthYear', Text('Date Created', "mm-yyyy")),
            DateCreatedMonthYear,
            GroupItem
        ),
        TotalCount,
        CountRows(GroupItem),
        SumNet,
        Sum(GroupItem,'Net Payable')
    )
)

That should give you the grouped collection you need.

本文标签: powerappsGet the count of rows and sum per monthStack Overflow