Forum Discussion

RonaldvdH's avatar
RonaldvdH
Post Patron
6 years ago

Minor adjustment ?

I need to alter this formula so that is can deal with blank values. 

This formula works if the column always has a value but now i want to use this formula for another column which may contain blank values and then the formula needs to skip that row.


Basically it only has to calculate if the colum 'OA retour gestuurd' has a (date) value that is why i thought i could use the red part in the formula but then it returns an error. When i skipp the red part it returns the error dat the begin and enddate in a calendar function cannot be empty.

 

Doorlooptijd correctie Sisu in Werkdagen = VAR YourDate = if(IsBlank([Afgerond]); TODAY(); [Afgerond])
RETURN
COUNTROWS( IF(Query1[OA retour gestuurd]<>null;
    FILTER(
ADDCOLUMNS(
            CALENDAR(
                [OA retour gestuurd];
                YourDate
            );
            "DayofWeek";
            WEEKDAY(
                [Date];
                2
            )
        );
        [DayofWeek] <> 6 && [DayofWeek] <> 7
    )))

4 Replies

  • v-eachen-msft's avatar
    v-eachen-msft
    Community Support

    Hi RonaldvdH ,

     

    You could replace "null" with "blank()" or use NOT(ISBLANK( Your logic )) . DAX unrecognizes the meaning of "null".

     

    • RonaldvdH's avatar
      RonaldvdH
      Post Patron

      v-eachen-msft both options return errors im afraid. 

       

      Doorlooptijd correctie Sisu in Werkdagen = VAR YourDate = if(IsBlank([Afgerond]); TODAY(); [Afgerond])
      RETURN
      COUNTROWS( if(not(ISBLANK(Query1[OA retour gestuurd];
          FILTER(
      ADDCOLUMNS(
                  CALENDAR(
                      [OA retour gestuurd];
                      YourDate
                  );
                  "DayofWeek";
                  WEEKDAY(
                      [Date];
                      2
                  )
              );
              [DayofWeek] <> 6 && [DayofWeek] <> 7
          )))))
      • v-eachen-msft's avatar
        v-eachen-msft
        Community Support

        Hi RonaldvdH ,

         

        After my testing, I found that you have wrong brackets(your "not" and "isblank" functions have wrong brackets). You could try the following DAX.

        Doorlooptijd correctie Sisu in Werkdagen =
        VAR YourDate =
            IF ( ISBLANK ( [Afgerond] ); TODAY (); [Afgerond] )
        RETURN
            COUNTROWS (
                IF (
                    NOT ( ISBLANK ( Query1[OA retour gestuurd] ) );
                    FILTER (
                        ADDCOLUMNS (
                            CALENDAR ( [OA retour gestuurd]; YourDate );
                            "DayofWeek"; WEEKDAY ( [Date]; 2 )
                        );
                        [DayofWeek] <> 6
                            && [DayofWeek] <> 7
                    )
                )
            )