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

Announcements

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 602

#2
WarrenBelz Profile Picture

WarrenBelz 473 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 310

Last 30 days Overall leaderboard