cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
srqdewfffffffff
Frequent Visitor

Calculate value based on Dropdown

Hi everyone,

 

I have a dropdown DataCardValue144_1 (Mês) where I have all the months (January to December) and each month has a multiplier factor of 12 to 1, respectively. 

When I select a month like July it multiples the value from DataCardValue150_4 = 10000 (Total Mensal) with the number 6, and the result in Label39_5 (Total Ano) is 60000.

 

This is my code inside Label39_5:

 

If(DataCardValue144_1.Selected.Value = "Julho"; Text(Value(DataCardValue150_4*6)); "")

 

srqdewfffffffff_2-1661814711653.png

 

I want to know if is possible to make this code work to all months inside Label39_5.

 

Today I make it work with 12 labels that are only visible when a especific month is choose on the dropdown.

 

Thanks for the help!

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
CarlosFigueira
Power Apps
Power Apps

Hello @srqdewfffffffff 

 

The Items property of the dropdown can be a table with multiple columns. So if you set it to the following expression:

Table(
  { Nome: "Janeiro"; Multiplicador: 12 };
  { Nome: "Fevereiro"; Multiplicador: 11 };
  { Nome: "Março"; Multiplicador: 10 };
  { Nome: "Abril"; Multiplicador: 9 };
  { Nome: "Maio"; Multiplicador: 8 };
  { Nome: "Junho"; Multiplicador: 7 };
  { Nome: "Julho"; Multiplicador: 6 };
  { Nome: "Agosto"; Multiplicador: 5 };
  { Nome: "Setembro"; Multiplicador: 4 };
  { Nome: "Outubro"; Multiplicador: 3 };
  { Nome: "Novembro"; Multiplicador: 2 };
  { Nome: "Dezembro"; Multiplicador: 1 };
)

You can update the code in your label to something along the lines of

Text(Value(DataCardValue150_4.Text) * DataCardValue144_1.Selected.Multiplicador)

Hope this helps!

View solution in original post

2 REPLIES 2
CarlosFigueira
Power Apps
Power Apps

Hello @srqdewfffffffff 

 

The Items property of the dropdown can be a table with multiple columns. So if you set it to the following expression:

Table(
  { Nome: "Janeiro"; Multiplicador: 12 };
  { Nome: "Fevereiro"; Multiplicador: 11 };
  { Nome: "Março"; Multiplicador: 10 };
  { Nome: "Abril"; Multiplicador: 9 };
  { Nome: "Maio"; Multiplicador: 8 };
  { Nome: "Junho"; Multiplicador: 7 };
  { Nome: "Julho"; Multiplicador: 6 };
  { Nome: "Agosto"; Multiplicador: 5 };
  { Nome: "Setembro"; Multiplicador: 4 };
  { Nome: "Outubro"; Multiplicador: 3 };
  { Nome: "Novembro"; Multiplicador: 2 };
  { Nome: "Dezembro"; Multiplicador: 1 };
)

You can update the code in your label to something along the lines of

Text(Value(DataCardValue150_4.Text) * DataCardValue144_1.Selected.Multiplicador)

Hope this helps!

srqdewfffffffff
Frequent Visitor

Sorry for the delay! 
This solution worked for me!  
Thank you so much, @CarlosFigueira 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,548)