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 / How can I calculate a ...
Power Apps
Answered

How can I calculate a checksum of a number based on a weighting?

(1) ShareShare
ReportReport
Posted on by 89

Hi,

 

I want to calculate a checksum of a number based on a weighting.
To let it keep simple, I have a number  varNumber 123456.
The weighting is varWeigthing 131313.
I want to multiply the first position of varNumber with the first position of varWeigthing and so on and get the sum as a result.
In this example:

1 * 1 = 1

2 * 3 = 6

3 * 1 = 3

4 * 3 = 12

5 * 1 = 5

6 * 3 = 18


1+6+3+12+5+18 = 45

So I want to get the result 45.

Any idea?
Thanks

Stefan

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @stefansc,

     

    With the assumption that both numbers will be of equal length / have the same amount of characters, you could use the code below. I have added inline comments to further explain the functionality.

     

     

    Set(
     gblTotal,
     //Sum the returned array of products
     Sum(
     ForAll(
     //Loop through the amount of characters
     //Sequence generates an array of sequential numbers up to the amount defined
     Sequence(Len(varNumber)),
     //Fetch the number at the current loop's index for both variables & multiply
     Index(
     Split(
     varNumber,
     ""
     ),
     Value
     ).Value * Index(
     Split(
     varWeigthing,
     ""
     ),
     Value
     ).Value
     ),
     Value
     )
    )

     

     


    If this solves your question, would you be so kind as to accept it as a solution✔️

    If you liked my solution, please give it a thumbs up👍

     

    Connect with me: LinkedIn | Blog

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard