How to calculate the difference between every two years and k-means clustering question.

EvelynEvelyn Member Posts: 2 Newbie
edited December 2019 in Help

Currently this is my data view

In the result, first, i need to get the difference between revenue-expenses between every two years (2018-2017; 2017-2016..)
The result I get must be in percentage
May I know how to do this? I have tried using generate attribute, date diff also didnt work

Besides that, this is my k-means clustering results

Although the result is correct already, but my lecturer ask me to convert the result into percentage form?

Does anyone can help? Thanks in advance and I'm really appreciate your help.


  • Options
    Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,635 Unicorn
    The problem with Generate Attributes is probably that you did not explicitly reference the attribute names, which appear to be numbers, so when you created the expression, RapidMiner thought you just wanted the difference between 2018 and 2017 (i.e., 1).
    To do this correctly, you need to enclose the name of the attributes in square brackets. So your expression would be something like this:
    "2018_percent_change" = ([2018.0]-[2017.0])/[2017.0] 
    There are obviously several ways to calculate percentage changes so you have decide on the appropriate denominator.
    If you have a lot of these attributes to define, instead of doing it manually, you could also use a loop and macros to create them all for you automatically.
    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
Sign In or Register to comment.