Forum Discussion

Clint's avatar
Clint
Icon for Helper V rankHelper V
7 years ago
Solved

Using isBlank to return blank when no value provided in a field

Hello,

 

Trying to use the following as part of an if statement to suppress the return of a RYG indicator but getting the error "A single value cannot be determined for column "Task Finish Baseline Date" in Table Task Baselines.....  I created this as a calculated column as I thought this would avoid this sort of error.  Shouldn't this expression be evaluated row by row against this table?  This would return a single value in this column if so.  Any thoughts on why this is returning this error?
C_Task MS RYG = If(isBlank('Taskbaselines'[task baseline finish date]), BLANK(),

15 Replies

  • Cmcmahan's avatar
    Cmcmahan
    Icon for Resident Rockstar rankResident Rockstar

    When calculating a column, try this to get a single value:

     

    C_Task MS RYG = If(isBlank(EARLIER('Taskbaselines'[task baseline finish date])), BLANK(),
    • Clint's avatar
      Clint
      Icon for Helper V rankHelper V

      Thank you Cmcmahan  - this returns the error "earlier/earliest refers to an earlier row context which doesn't exist"

      • Cmcmahan's avatar
        Cmcmahan
        Icon for Resident Rockstar rankResident Rockstar

        Ugh. I hate messing with EARLIER/EARLIEST.

         

        The root problem here is that when you evaluate this

        ISBLANK('Taskbaselines'[task baseline finish date])

        DAX is returning a list of values.  You're asking "Is this value blank?" and giving the function a whole column of values.  DAX gives up and tells you there's an error.  What you need is a way to select one of those values.  Depending on the context you're in, you may be able to use SELECTEDVALUE, RELATED or some other aggregation function to get one value out of the list.

         

        Is the table you're adding this column to the same one the value is in?