Forum Discussion

UK_User123456's avatar
UK_User123456
Icon for Resolver I rankResolver I
6 years ago
Solved

Ranking and calculating the difference

Hi All,

 

I am working with Ranking and currently using RankX. I have multiple gift dates that could have been given by the same person over a period of time. I have ranked each of the gifts by date and used 2 measures to give me the last gift and the gift prior to this. Is there anyway of being able to calculate the difference between the last gift and gift prior to last?

 

Im assuming because I have used a measure to give me the gift dates I require that I cannot use another measure to do

last gift - gift prior to last? When I do this, it always gives me a date and not a number any ideas? I cannot change the format or data type as these options are greyed out.

 

TIA

  • Hi UK_User123456 

     

    Have you tried using the VALUE function to covert the result into a number?

    For example:

     

    Date Diff = VALUE ( [Last gift] - [Gift prior to last] )

     

    Best regards,

    Martyn

  • MartynRamsden's avatar
    MartynRamsden
    6 years ago

    Hi UK_User123456 

     

    How about this?

     

    Date Diff = 
    IF ( 
        NOT ISBLANK ( [Gift date prior to last] ),
        VALUE ( [Last gift date] - [Gift date prior to last] ),
        BLANK()
    )

     

    Best regards,

    Martyn

19 Replies

  • Hi UK_User123456 

     

    Have you tried using the VALUE function to covert the result into a number?

    For example:

     

    Date Diff = VALUE ( [Last gift] - [Gift prior to last] )

     

    Best regards,

    Martyn

    • UK_User123456's avatar
      UK_User123456
      Icon for Resolver I rankResolver I

      MartynRamsden  is there a way of incorporating a blank statement in with your response, so that when there is a blank, it returns nothing?

       

      TIA

      • MartynRamsden's avatar
        MartynRamsden
        Icon for Solution Sage rankSolution Sage

        Hi UK_User123456 

         

        There will definitely be a way to handle the blank values but it depends where they occur.

        Do you have an example?

         

        Best regards,

        Martyn