Navigation

    Communauté Digdash

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    UNSOLVED Comparison with NaN

    Studio
    3
    4
    247
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Madeleine last edited by

      Hello,

      I created a calculated measure to see:
      var x = selected month
      var y = month -1

      if x >= y return 1
      if x < y return -1

      but the issue is that I don't know how to get the result 0 if x == NaN or 0 or
      y == NaN or 0 or
      x == value and y == NaN

      please see column Matrix 1.3

      var x = <Selected Month(NO_AGG)>;
      var y = <Month-1(NO_AGG)>;

      if(x < y ) {
      return -1; //
      } else if (x => y && x,y!=0 ) {
      return 1; // ok
      } else {
      return 0 // code that will execute if all above conditions are false

      }

      Thank you for your help,

      4d13457d-cfc7-4135-8bc7-b4bc43cd8c7e-image.png

      1 Reply Last reply Reply Quote 0
      • G
        Ghezal_Salma last edited by

        Hello,
        try this :

        var x = <Selected Month(NO_AGG)>;
        var y = <Month-1(NO_AGG)>;
        if(x < y ) {
        return -1; //
        } 
        else if (x => y && x,y!=0 ) {           
        return 1; // ok
        } 
        else if (isNaN(x)) {                             
        return 0 
        }
        
        1 Reply Last reply Reply Quote 0
        • M
          Madeleine last edited by

          Merci beaucoup pour votre aide, mais the result is not ok, returns -1, no change

          14c92bd6-afff-44ac-bf05-63c0a597224d-image.png

          GregoryBiraud 1 Reply Last reply Reply Quote 0
          • GregoryBiraud
            GregoryBiraud Expert DigDash @Madeleine last edited by

            Hi @madeleine ,

            Have you tried :

            var x = <Selected Month(NO_AGG)>;
            var y = <Month-1(NO_AGG)>;
            if(x < y ) {
                return -1; //
            } else if (x => y && x,y!=0 ) {           
                return 1; // ok
            } else if (x == null || !x) {                             
                return 0 
            }
            

            Grégory Biraud

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            • Accueil
            • Webinaires
            • Documentation
            • Interviews
            • Vidéos tutos