I HAVE A GALLERY WITH ITEMS PROPERTY WITH THE FOLLOWING
FirstN(
LastN(
Distinct(
Filter(
'Impact ',
'Risk _Category '.Risk_name = VarTop.Risk_name
),
Question
),
CountRows(
Distinct(
Filter(
'Impact ,
'Risk _Category '.Risk_name = VarTop.Risk_name
),
Question
)
) - (varCurrentPage - 1) * 4
),
4
)
I have a next button which is outside the gallery, when user clicks on it, the next four items will display
If(
varCurrentPage < RoundUp(
CountRows(
Distinct(
Filter('Impact ,'Top IT .Risk_name = VarTopItForBottomUp.Risk_name
),
Question
)
) / 4,
0
),
Set(varCurrentPage, varCurrentPage + 1)
)
I have a previous button which is outside the gallery, when user clicks on it, the previous four items will display
If(
varCurrentPage > 1,
Set(
varCurrentPage,
varCurrentPage - 1
)
)
I have a label which is inside the gallery the gallery which shows the value of the impact
I have another label which is outside the gallery which shows the sum of values inside the gallery Label
Sum(
ForAll(
Gallery4.AllItems,
Value(Label5.Text)
),
Value
)
The problem Iam facing is when clicks on the next button the count of the sum which is done for the first 4 items is gone
and starting from the default as Zero
the sum resetting when navigating through pages in My gallery. the fact that the Sum function in PowerApps recalculates based on the currently visible items in the gallery. When you change pages, the visible items change, which resets the sum.
Could anyone please help me to fix the issue
You need to either use the Label or a field in the Items. If not, you would need a separate filter to what is displayed in the Gallery and do a sum on that.
HI @WarrenBelz
Thanks for the response
so if u could see my screenshot for all the responses choosed by the user I have value corresponding to that column in the dataverse table
Is there is any way we could do the calculation without using the label inside the gallery
Hi @Danny_Dicaprio ,
That is not going to work with what you are doing as Sum(Gallery . . .) will only add what is displayed by the Gallery Items. The problem also is that there is no control over how many times or in what order the user clicks the two buttons, so doing some sort of progressive Variable is problematic.
Hi @WarrenBelz
Thanks for the response
when I click on the next button the previous sum is not getting calculated along with the new sum
Iam looking for the final sum in the label from all the items
Sum( Gallery4.AllItems, Value(Label5.Text) )
in the label outside the gallery it is showing the count of the last 4 items in the gallery , Not the previous one
The Sum seems to be correct based on the figures at the right of the items - what is not working ?
Hi @WarrenBelz
Thanks for the response but still Iam facing the same issue
I have updated the items gallery and the label
when I clicks on the Next button the above label which shows the count 11 is getting back to default
Hi @Danny_Dicaprio ,
Just did a test here using a similar structure test list - apart from cutting down the Items to
With(
{
_Data:
Distinct(
Filter(
'Impact & Assessment Evaluations',
'Top IT Risk _Category '.Risk_name = VarTopItForBottomUp.Risk_name
),
Question
)
},
FirstN(
LastN(
_Data,
CountRows(_Data) - (varCurrentPage - 1) * 4
),
4
)
)
and the Label to
Sum(
Gallery4.AllItems,
Value(Label5.Text)
)
with the other to the same, it worked perfectly as below.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
MS.Ragavendar
32
Michael E. Gernaey
19
Super User 2025 Season 1
WarrenBelz
18
Most Valuable Professional