1 Reply Latest reply on Sep 4, 2018 10:31 AM by Patrick A Van Der Hyde

    Logic Calculations in Tableau with Conditions

    sunny p

      I have a given case. How to solve this calculation in Tableau. Can some one please guide me how to work on it.

      In the given case each ID has different charts and each chart has different codes. I need to Calculate three columns based on the given conditions.

      * Column 1 - Total User Charts - Based on ID need to show how many charts went to each user level

      conditions for this column - If user1 status =user2 status then count is 0 else  1, if user1 status =user 3 status then 0 else 1,

      while comparing with user1 and user2 if user 2 is null then check with user 3 if user2 and user3 are null then 'N/A', No comparison between user2 and user3 status.

      *Column 2 - Total errors in chart - Count of charts with errors based on user status

      "Except delete code status all user status follow this rule" -

      If user1 status =user2 status =user3 status then error count is zero.

      user1 status= user2 then error count is Zero, user1=user2 but <>user3 then error count is 1, user1<>user2=user3 then error count is 1

       

      When ever 'delete code' status come in to picture then comparison has to made between user1, user2  and user3 and then need to compare with second status existing below this 'delete code' status.

      In first case both users are <> user3 so total error chart count is 1 and total error code count is 2,

      In Second case all three users have delete code but second status  is not same so total chart error is 1 and total error code count is 1

      user1 status user2 status user3 status
      delete code delete code Delete
      auto code addauto code Add no code Add
      delete code delete codedelete code
      auto code add auto code addno code add

      *Column 3 - Total errors in code - Count of codes with errors based on user status

      If user1 status =user2 status =user3 status then error count is zero.

      user1 status= user2 then error count is Zero, user1=user2 but <>user3 then error count is 1, user1<>user2=user3 then error count is 1

      In below case total code errors = 2

       

      codeuser1 status user2 status user3 status
      z794delete delete delete
      auto code add
      z682 confirm confirmconfirm
      z684 auto code add auto code addauto code add