1 Reply Latest reply on Aug 30, 2018 5:01 AM by marco Neu

    First value, if ID switched

    marco Neu

      Hello,

       

      i am looking for code to get a certain value, if the ID is switched.

       

      Example:

       

      LS8IDState
      AIR1up
      FLUID1up
      FLUID1run
      FLUID1down
      AIR2up
      FLUID2up
      AIR2run
      AIR2down
      FLUID3up
      AIR3up
      AIR3run
      AIR3down

       

      Now I want the first value of LS8, if the state is up (first value of "up", could be more in up) and the ID is changed. It should look like this:

       

      First = AIR

      Second = AIR

      Third = FLUID

       

      Then the AIR and FLUIDS should be counted. like 2 x Air and 1 x FLUID and compared to each other. It should look like this 33,3% Fluid and 66,6 % AIR

       

      I tried to use the FIRST-Code but I dont get any useful results

       

      "

      .IF [State] = 'UP'

      AND [value LS8] == 'FLUID'

       

      THEN 1

      ELSE 0

      END

       

      "

      This Code isnt working, because its counting every value of the state "up" and not just the first. I looked it up, but i just found SELECT and it isnt implemented in Tableau.

       

      Thank you!

       

      PS: I already organized, that I just need the ID and filtered the state to up. So I need the session ID, if this is whole new process and should get counted.