Visokio website     Downloads     Video tutorials     KnowledgeBase  
Bar/Line View: Formula for Month over Month - Visokio Forums
Bar/Line View: Formula for Month over Month
  • Milton Milton August 21, 2013 12:50PM
    I need to generate a variation percentage month over month inside a Bar/Line View, this variation should be functional for a metric existing in DataManager [Clicks] and also for a metric calculated inside the the same graphic (CTR).

    We have tried with "subset_sum" and "subset_mean" but it is not possible to do the calculation. Can you please help me with this?


    IF(SUBSET_SUM([Month])="Febrero",SUBSET_SUM([Likes]))/IF(SUBSET_SINGLETON([Month])="Enero",SUBSET_SUM([Likes]))-1

    IF(SUBSET_SUM([Likes])>0,(SUBSET_SUM([Likes],SUBSET([Mes],2))-SUBSET_SUM([Likes],SUBSET([Mes],1)))/SUBSET_SUM([Likes],SUBSET([Mes],1)))
  • 4 Comments
  •        daniel August 23, 2013 4:34AM
    Is the subset_sum function being used correctly? I don't think SUBSET_SUM([Month] ="Febrero") actually works, as you can't sum a category or date field.

    Normally it is the quantity value first then the defined subset i.e.

    SUBSET_SUM( [Likes] , SUBSET([Month] , "Febrero") - to get the sum of all the likes in that month.

    So it should look like:


    SUBSET_SUM( [Likes], SUBSET( [Month]) )/ SUBSET_SUM ( [Likes], SUBSET ([Month] -1))

    Not stating a month will give you the calculation for the month of that current row if you are using it as a new field. Otherwise in content view it should just be:


    SUBSET_SUM( [Likes], SUBSET ([Month],"Febrero")) / SUBSET_SUM ( [Likes], SUBSET ([Month],"Enero"))


    I'm not sure if the function will accept the -1 on month.


    I haven't tested the functions so I'm not sure if that works, alternatively you can explore using aggregations operations in the DM to calculate those monthly values for you and treat it as a separate data source for monthly figures.

    I'll try to do a demo for this on Monday if I get the time.
  •        daniel August 30, 2013 7:52AM
    I've made a simple example here, I've broken the function up into several columns though just cause it was easier.
    Attachments
    Example.iok 15K
  •     davedunckley September 9, 2013 6:37AM
    Hi,

    There above example is just what I need also.

    However, I would like to be able to have a subset bassed on a boolean. So that I can say, if quesion = 'y' then show the total.
  •        daniel September 9, 2013 7:56AM
    If you need it to count based on month and a Y/N field it might be a bit trickier but you should be able to use the intersection() with subset.
    Attachments
    Example2.iok 17K

Welcome!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership