4 Replies Latest reply on Oct 14, 2013 11:37 PM by bart.groots

    SHOW even if there is no value

    bart.groots

      Hello,

       

      I have this formule:

       

      IF SUM(CASE [Toestand] WHEN "0" THEN -1

      ELSE 1

      END   )> 0 THEN "Alarm"

      ELSE "No Alarm"

       

      END

       

      I filter on TODAY,  But if there isnt a record for today, my worksheet is empty..

      I like to SHOW ''no alarm" if there isnt a record...

       

      Can someone help me out?

       

      thanks!

       

      Greets

        • 1. Re: SHOW even if there is no value
          Michael Crow

          I faced a similar issue and figured out a partial workaround for some situations. Maybe it will work for you: http://community.tableau.com/thread/130223

          • 2. Re: SHOW even if there is no value
            Matt Lutton

            May want to vote: http://community.tableau.com/ideas/2204

             

            I was pretty sure I'd seen someone create a workaround for this recently, but I cannot find it now.

            • 3. Re: SHOW even if there is no value
              Joshua Milligan

              Bart,

               

              You can probably use a table calculation to filter the data rather than TODAY.  This will allow you to keep at least one row in the underlying data, which is required to draw any marks (with no rows, you'll get  a blank viz).

               

              I've attached a possible solution.  It makes the assumption that your underlying data has a set of past dates up to possibly including today.  If your data could include future dates, you'll have to modify the solution slightly.

               

              Here's the setup:

               

              Alarm.png

               

              The field [Alarm] is your calculation above.  The [First] field is the calculation First() == 0, which is true for the first row and false for every other.  I've sorted [Date] to keep the most recent at the top -- this is important, because I want the first date to be either today or the most recent date in the past.  [Today's Alarm] is the calculation:

              IF [First]
                  THEN IF ATTR([Date]) == TODAY() THEN [Alarm] ELSE "No Alarm" END
              END
              
              

               

              So what this is doing is checking to see if the first row is Today.  If so, the value of Alarm will be used.  If not, it will be "No Alarm" regardless of what the original calculation resulted.  Notice that the result here is "No Alarm" even though the value for 10/12/2013 is "Alarm" -- that's because there is no record for Today.

               

              The final step is to clean this up so that only the first row is kept in the viz.  That way, you'll see only "Alarm" (if it is today and it was an "alarm" or "No Alarm" otherwise).

               

              2.png

               

              You'll notice I simply moved [First] to filters and kept it when it was true.  I removed [Alarm] from the viz and then hid the headers for [Date].

               

              You may want to add in a relative date filter that gets only the last few days of data.  That will improve performance as that initial view doesn't need all the dates -- it just needs one, so there is no reason to pull all of them from the data source.

               

              Hope that helps!

               

              Regards,

              Joshua

              • 4. Re: SHOW even if there is no value
                bart.groots

                Joshua,

                 

                Thanks for your input! it is a great solution..

                Many thanks!

                 

                 

                Greets Bart