cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cah2035
Helper II
Helper II

Data table takes first value and doesn't sum until I leave and come back to the screen

I have a data table on my app that is displaying monthly spending information. the "on visible" action for the screen is as follows:

ClearCollect(
    colSpendingTable,
    Sort(
    AddColumns(
        GroupBy(
            Filter(
                SpendingReport,
                FYNum = Dropdown1_1.Selected.Result
            ),
            "ProjectValue",
            "ProjectSpendingData"
        ),
        "July",
        Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 1),
            Cost
        ),
        "August",
 Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 2),
            Cost
        ),
        "September",
 Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 3),
            Cost
            
        ),
        "October",
 Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 4),
            Cost
        ),
        "November",
 Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 5),
            Cost
        ),
        "December",
Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 6),
            Cost
        ),
        "January",
 Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 7),
            Cost
        ),
        "February",
 Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 8),
            Cost
        ),
        "March",
 Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 9),
            Cost
        ),
        "April",
 Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 10),
            Cost
        ),
        "May",
Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 11),
            Cost
        ),
        "June",
Sum(
            Filter(ProjectSpendingData,
            FYPeriod = 12),
            Cost
        ),
        "Total",
        Sum(
            ProjectSpendingData,
            Cost
        ),
        "ProjectName",
        If(
            ProjectValue < 1,
            LookUp(
            ProjectList,
            ProjectValue = ProjectNum,
            ProjectName),
            Text(ProjectValue)
        )
    ),
    ProjectValue,
    Ascending
))

 

Essentially, I took my single table of all spending and grouped by Project Value, since I am organizing my monthly spending by project. So after that, I am left with a table of project numbers and a table for each will all spending for the year. I then used AddColumns to take the sum of costs from the nested table, and filtered by Period since I want to sum for each month. 

In the below picture, the front table, as an example, is showing the all the costs for the month of July for one project. However, on the data table circled in red is not the sum of those, but is only taking the first value. But the weird and confusing thing is that when I leave the screen and navigate back, the values are then corrected (I don't have any navigation functions to change this data table, it is all coming from the OnVisible property. I can't see to figure out when when first opening the app (both the published app and in the editor) it is only showing me the first value and not summing. 

 

cah2035_0-1598647891360.png

 

1 REPLY 1
Eelman
Super User
Super User

@cah2035 

In the editor, have you tried using the Monitor tool to see if it's a time lag issue?

 

Open Advanced Tools --> Monitor, then run your OnVisible code and review the Monitor data. There's a lot of Filtering & Summing going on so this maybe the issue? If you find that it is a time issue maybe consider adding some of what you need to the App OnStart?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,810)