Profile picture for user Roy

Hello all,

I'm trying to edit a feed but I have problems with calculations that I want to do on the data source. My data source is a simple excel file with two columns as depicted below:

In the feed I want to calculate for the amount, what percentage b+c make out of the Total.

In other words, I want to calculate this: ((b+c)/total)*100%. Right now I perform the calculation in excel and use the result in Mashzone but I expect the calculation to be possible in Mashzone as well.

Any help is welcome I have tried many combinations of operators but I don't seem to figure this one out.

Thanks, Roy

by Stephan Freudl
Posted on Thu, 02/18/2010 - 09:23

Hi Roy,

of course MashZone can help you. There are actually two ways to achive this. The first is rather simple and assumes that  -- as in your example -- each amount represents percentages already, i.e. total remains 100 constantly.

So finding the percentage of row b and c is a question of filtering for only this rows and sum up their amount values. The example depicted below uses the filter operator to select the proper rows. The aggregation is done during data assignment -- a plain text field consists of two parts: "Percentage of b and c: " and the sum of all values found in the amount column.

The second one becomes useful when the total is something different from 100. In this case we need a data feed operator which is called Goal accomplishment. Practically it has three inputs.

  1. All the records to calculate Goal accomplishments (connector point on the upper side of the feed operator)
  2. One single value to know what value represents 100% - we will determine this dynamically. Connectors for single input values reside on the right hand side of the operator.
  3. Same as before but for the lower bound - what represents 0%. We will constantly assume 0, but it works as above.

So to do Goal accomplishment we need two distinct information from your feed. Therefore we create a copy of the data read at the beginning. This is done using the data feeds copy operator placed directly after the data source. Now we have up to four parallel paths of calculation.

The sum is determined dynamically on the right hand side. We use the operator Calculation > Aggregation to sum all values found in the column amount. This results in a feed with one column and row (yes aggregation is tricky). The operator Values > Determine value converts this one cell feed into something we can use later. Please note: the determine value operator has no output connector on its bottom. It just converts multiple records into single ones.

On the left hand side Goal accomplishment has been inserted. It is configured as described before. The edge highlighted provides the dynamically calculated total. (I modified the test data to get meaningful values in this case.) The filtering and rest you already know.

0
by Roy Diemeer Author
Posted on Tue, 02/23/2010 - 13:27

Hi Stephan,

Thanks a lot, this is very helpful!

kind regards,

Roy

0

Featured achievement

Question Solver
Share your expertise and have your answer accepted as best reply.
Recent Unlocks
  • CR
  • BH
  • Profile picture for user Ivan.Ivanov.softwareag.com
  • Profile picture for user mscheid
  • MS
  • PacMan

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock