3 Replies Latest reply on Dec 19, 2016 7:51 AM by Mahfooj Khan

    Sort the result

    Sultan Altowerqi

      Hi,

       

      This is Sultan and I have some problem with my data and I appreciate if any of you guys help me. I think the problem is in the calculated field. Let me explain in details

       

      1. I got my data from a DataBase and it is for 2 season. I have two columns I need to subtract it from each other to get I result. So I create the following calculated field to get the result first and later on create a calculated filed for each season:

      The calculated field for the subtraction is:

      [SUM(UR_ESCAPED)] - [SUM(UR_ESCAPED_EXIT)] I called this field as Escaped

      2. I create another calculated filed to get the escaped for a specific season:

      IIF(([UR_SEASON]) = 2015, ([Escaped]),0)

      2. The third calculated field for the next season:

      IIF(([UR_SEASON]) = 2016, ([Escaped]),0)

       

      I got a result in Tableau but the problem is the data is totally different when I compare it with the DataBase I believe that there is a mistake in calculation fields.

      Furthermore, I have used a filter for only the date and month to compare between two seasons until the day I have entered in the filter. I have used the same formula with other columns and it is working fine and the data in both seasons are is correct but the only different between this and the problem above is I have one columns but the problem here is I think because I have two columns which is [SUM(UR_ESCAPED)] and  [SUM(UR_ESCAPED_EXIT)] maybe!!

       

      It would be grateful if any of you help me in this regard and I look forward to hearing from you soon

       

      Thanks in advance,
      Sultan

       

      Message was edited by: Sultan Altowerqi

        • 1. Re: Sort the result
          Mahfooj Khan

          Hi Sultan,

           

          As per my understanding you can try this,

           

          Calculated individual escaped

          Season 2015:

          UR_ESCAPED 2015

          IF [UR_SEASON]=2015 THEN [US_ESCAPED] END

           

          UR_ESCAPED_EXIT 2015

          IF [UR_SEASON]=2015 THEN [US_ESCAPED_EXIT] END

           

          ESCAPED IN 2015

          SUM([UR_ESCAPED 2015]) - SUM([UR_ESCAPED_EXIT 2015])

           

          Similarly for 2016 season:

          UR_ESCAPED 2016

          IF [UR_SEASON]=2016 THEN [US_ESCAPED] END

          UR_ESCAPED_EXIT 2016

          IF [UR_SEASON]=2016 THEN [US_ESCAPED_EXIT] END

           

          ESCAPED IN 2015

          SUM([UR_ESCAPED 2016]) - SUM([UR_ESCAPED_EXIT 2016])

           

          Let me know If this help.

           

          Mahfooj

          • 2. Re: Sort the result
            Sultan Altowerqi

            Thanks Mahfooj for your quick response unfortunately, your answer doesn't work well. Do you have another idea?

            • 3. Re: Sort the result
              Mahfooj Khan

              Without seeing your underlying data we can not give your correct solution. Share some sample data with your desired output.

              Attach a packaged workbook in .twbx format If possible.