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

Calculate Average Based On Selection Of DropDownList

If(Dropdown2.Selected.Value = "Calculate two", (TextInput11.Text=Text(Average(Value(TextInput9.Text),Value(TextInput10.Text)))));

 

I want to calculate the average based on selection on dropdownlist, but it seem not working and I can't find out what's wrong with my code. 

Is that any better solution for this? Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User III
Super User III

Hi @NeohLooi 

The issue is that it is not possible to make assignments in the way that you're attempting. For example, we cannot use the syntax TextInput11.Text= to assign a value to the TextInput11 control.

If you were to set the text property of TextInput11 to the following formula, that should hopefully take you further.

 

 

If(Dropdown2.Selected.Value = "Calculate two",    
   Text(Average(Value(TextInput9.Text),
                Value(TextInput10.Text)
        )
    )
)

 

 

View solution in original post

4 REPLIES 4
Eelman
Super User
Super User

@NeohLooi 

Is TextInput11 the control where you want the Average to appear? If so, you don't need to reference it so remove that part of your formula ie

 

If( Dropdown2.Selected.Value = "Calculate two", Text( Average(...) ) )

timl
Super User III
Super User III

Hi @NeohLooi 

The issue is that it is not possible to make assignments in the way that you're attempting. For example, we cannot use the syntax TextInput11.Text= to assign a value to the TextInput11 control.

If you were to set the text property of TextInput11 to the following formula, that should hopefully take you further.

 

 

If(Dropdown2.Selected.Value = "Calculate two",    
   Text(Average(Value(TextInput9.Text),
                Value(TextInput10.Text)
        )
    )
)

 

 

View solution in original post

I want it trigger on button , is that anyway to do it?

timl
Super User III
Super User III

Hi @NeohLooi 

Set the OnSelect property of your button to:

 

Set(varAverage,
If(Dropdown2.Selected.Value = "Calculate two",    
   Text(Average(Value(TextInput9.Text),
                Value(TextInput10.Text)
        )
    )
)
)

 You can then set the Text property of your text input control to varAverage.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (847)