cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Englishweb
Post Patron
Post Patron

Avoid circular reference on calculated field

Hello 

I have a calculated field: Sum(Gallery1.AllItems, HOURS).

I would like to show the result on a different screen, but duplicating it gives a circular ref warning.

How can I convert a calculation value to a text label?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User III
Super User III

OnVisible of the Current screen where you have the Gallery, put this variable:
Set(MyCalFigure,Sum(Gallery1.AllItems, HOURS))
Insert another label in the screen2 and put the Variable on the Text property:
MyCalFigure

View solution in original post

3 REPLIES 3
eka24
Super User III
Super User III

OnVisible of the Current screen where you have the Gallery, put this variable:
Set(MyCalFigure,Sum(Gallery1.AllItems, HOURS))
Insert another label in the screen2 and put the Variable on the Text property:
MyCalFigure

View solution in original post

v-yutliu-msft
Community Support
Community Support

Hi @Englishweb ,

Do you want to use the result of "Sum(Gallery1.AllItems, HOURS)" in multiple screens?

I suggest you save this formula's result as a variable.

Then use the variable in multiple screens, for example, display in a text label.

Could you tell me the formula in Gallery1's Items property?

If the items in gallery1 will not change, you could directly set the screen's OnVisible that has gallery1:

Set(var,Sum(Gallery1.AllItems, HOURS)

 If the items in gallery1 will change based on a button or a drop down, you need to set the button's OnSelect or the drop down's OnChange to this formula:

Set(var,Sum(Gallery1.AllItems, HOURS)

 Then, set the label's Text:

var

The label will display the calculated result, no matter in which screen.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-yutliu-msft @eka24 

Thank you both for your help.

The Set variable works, but the value is the same for each record in the 2nd Gallery. 

How do I combine a variable with ThisItem,Student1 to get individual results for each record? At the moment it just displays the last value recorded.

calculate hours.jpg

The filter for the Calculation Gallery is:

Filter(DFTCURRENTHRS;TutorSurname = LabelTutorNameSurname.Text

The calculation field is: Sum(GalleryCurrentHrs1.AllItems; HOURS)

Hope you can help!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (66,844)