Hello, So i have a data table which i have to add a number of extra columns to. One being a percentage of the score vs the potential score. I now want a sum of the filtered data table (so it only shows the sum for that month for that agent) but i can not work it out I have tried, but it doesnt work:
Sum(Filter(Table1, Agent ' = Dropdown2.Selected.'Agent Name ', Label4.Text = Text(MonthStats)), Percentage)
This is the formula in the data table:
Filter(AddColumns(AddColumns(Table1, "MonthStats", Text(Month(Date_x0020_)), "FormattedDate", Text(Date_x0020_, "[$-en-GB]dd/mm/yyyy"), "Score", If('Did the response resolve their enquiry?'= "Yes", 10, 0), "PotentialScore", 10),"Percentage", Sum((Score / PotentialScore)*100)),'Agent ' = Dropdown2.Selected.'Agent Name ', Label4.Text = Text(MonthStats))
Solved! Go to Solution.
The issue is that the DataTable does not serve as a datasource. Galleries have an AllItems property which can be used in this way, but DataTables do not. Therefore, you will not have access to your added columns outside of the table.
What I would recommend is to create a collection with the formula you have. You can place this in the OnVisible action or some other place as you see fit - perhaps needed in your OnChange of the Agent dropdown.
ClearCollect(colMyData,
Filter(
AddColumns(
AddColumns(Table1,
"MonthStats", Text(Month(Date_x0020_)),
"FormattedDate", Text(Date_x0020_, "[$-en-GB]dd/mm/yyyy"),
"Score", If('Did the response resolve their enquiry?'= "Yes", 10, 0),
"PotentialScore", 10
),
"Percentage", Sum((Score / PotentialScore)*100)
),
'Agent ' = Dropdown2.Selected.'Agent Name ', Label4.Text = Text(MonthStats)
)
)
Then set your datatable items to colMyData
Now you can use that collection in your sum formula:
Sum(colMyData, Percentage)
By the way - in this formula, we're not filtering by agent or month because the collection is already filtered by that.
I hope this is helpful for you.
The issue is that the DataTable does not serve as a datasource. Galleries have an AllItems property which can be used in this way, but DataTables do not. Therefore, you will not have access to your added columns outside of the table.
What I would recommend is to create a collection with the formula you have. You can place this in the OnVisible action or some other place as you see fit - perhaps needed in your OnChange of the Agent dropdown.
ClearCollect(colMyData,
Filter(
AddColumns(
AddColumns(Table1,
"MonthStats", Text(Month(Date_x0020_)),
"FormattedDate", Text(Date_x0020_, "[$-en-GB]dd/mm/yyyy"),
"Score", If('Did the response resolve their enquiry?'= "Yes", 10, 0),
"PotentialScore", 10
),
"Percentage", Sum((Score / PotentialScore)*100)
),
'Agent ' = Dropdown2.Selected.'Agent Name ', Label4.Text = Text(MonthStats)
)
)
Then set your datatable items to colMyData
Now you can use that collection in your sum formula:
Sum(colMyData, Percentage)
By the way - in this formula, we're not filtering by agent or month because the collection is already filtered by that.
I hope this is helpful for you.
That is exactly what i was after I thought it would need a collection somewhere but couldnt work out how that would work with me changing the dropdowns all the time but on change for both dropdowns works perfectly! Thanks
User | Count |
---|---|
164 | |
91 | |
67 | |
64 | |
63 |
User | Count |
---|---|
212 | |
157 | |
96 | |
81 | |
73 |