web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add unit after number ...
Power Apps
Unanswered

Add unit after number and use this for calculation

(0) ShareShare
ReportReport
Posted on by 140

Hello,

 

I have a TextInput field and I add a unit by this expression:

 

 

Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h"

 

 

But I want to use this TextInput field in another field to calculate the sum. The sum should also have a "h" attached.

How can I do this? 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @chhe 

    Something like this will do the trick.  Make sure to replace the + 100 with your own value.

    Value(
     Left(
     Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h",
     Len(Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h")-1
     )
    ) + 100
    

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • chhe Profile Picture
    140 on at

    Hello,

     

    for a test I have deleted the +100.

    But when I insert the code as follows, there is no "h" behind the value.

     

    Value(
     Left(
     Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h";
     Len(Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h")-1
     )
    )
  • mdevaney Profile Picture
    29,989 Moderator on at

    @chhe 

    Right, I was simply showing you how to add the numbers.  You can add 'h' at the end the same way @timl showed you previously.

     

    Text(
    Value(
     Left(
     Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h";
     Len(Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h")-1
     )
    ) + 100) & "h"

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • chhe Profile Picture
    140 on at

    I cant calculate with these fields.


    Field 1:

    result: 27,26h - everything fine

     

     

    Value(
     Left(
     Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h";
     Len(Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h")-1
     )
    ) & "h"

     

     

    Field 2:

    result: 10,26h - everything fine

     

     

    Value(
     Left(
     Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Kosten'.Text/100)) & "h";
     Len(Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Kosten'.Text/100)) & "h")-1
     )
    ) & "h"

     

     

    Field 3:

    This field should calculate the sum from Field 1 and 2.

     

     

    Text(
    Value(
     Left(
     Text(Value('ArbeitszeitSprint.Auftrag'.Text)+Value('ArbeitszeitSprint.Kosten'.Text)) & "h";
     Len(Text(Value('ArbeitszeitSprint.Auftrag'.Text)+Value('ArbeitszeitSprint.Kosten'.Text)) & "h")-1
     )
    )) & "h"

     

     

    The result is: 0h 

    But the result should be 37,62h (27,36h + 10,26h)

     

     

    I cant believe that it is so hard to add a user specific unity... Are there no other ways? 😄

  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @chhe 

    As a quick summary, to use the text input control values in the calculation, the key step is to remove the "h".

    @mdevaney  uses the standard, and valid technique of calling the Left function to return all the characters in the text input control, minus 1.

    Another method that you might find easier is to strip out the "h" by calling the substitute function. The snippet of code you would use looks like this:

    Substitue('ArbeitszeitSprint.Auftrag'.Text; "h"; "")

    The formula that you would use for your field 3 example would look like this.

    Text(
     Value(Substitue('ArbeitszeitSprint.Auftrag'.Text; "h"; ""))
     +
     Value(Substitue('ArbeitszeitSprint.Kosten'.Text; "h"; ""))
    ) & "h"
    


    Perhaps you could give that a try and see how you get on.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard