Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Calculating days difference

I am using Direct Query for my Power BI report. I want to calcualte the days taken to close an opportunity, using 2 columns "Actual Close Date" and "Created On".  I am using the following Dax Meas...
  • manvishah17's avatar
    2 years ago

    HI Anonymous , 
    I also encountered this error sometimes , it may happen if there are blank values in columns , to troubleshoot it , you can try this code 

    Days_to_Close = 
    IF(
        NOT(ISBLANK('your_table_name'[Actual Close Date])) && NOT(ISBLANK('your_table_name'[Created On])),
        DATEDIFF('your_table_name'[Created On], 'your_table_name'[Actual Close Date], DAY),
        BLANK()
    )

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!