Forum Discussion

StoryofData's avatar
StoryofData
Helper III
3 years ago
Solved

Empty Date Value

Wondering if there a smart way to do this, I have table with cases and their open and closed dates. 

For the times when the case is still open, I want the card to show "Still Open", I have achieved this using two measures: 

 

Date Closed = CALCULATE(MAX('Query1'[DateClosed]))
Date Closed Blank = IF( ISBLANK([Date Closed]) , "Still Open", [Date Closed] )
 
Is there a smarter way to achieve this, without using two measures?

 

 

  • lbendlin's avatar
    lbendlin
    3 years ago

    sure 🙂

     

    Date Closed Blank = COALESCE(FORMAT(CALCULATE(MAX('Query1'[DateClosed])),"MM/DD/YYYY") , "Still Open")

7 Replies

  • Your approach will only work when [Date Closed] is of type text. 

     

    You can use COALESCE

     

    Date Closed = FORMAT(CALCULATE(MAX('Query1'[DateClosed])),"MM/DD/YYYY")
    Date Closed Blank = COALESCE([Date Closed] , "Still Open")
    • StoryofData's avatar
      StoryofData
      Helper III

      Thank you! So there is no way to have only one measure to achieve this?

      • lbendlin's avatar
        lbendlin
        Super User

        sure 🙂

         

        Date Closed Blank = COALESCE(FORMAT(CALCULATE(MAX('Query1'[DateClosed])),"MM/DD/YYYY") , "Still Open")