Forum Discussion

wuhao0506's avatar
wuhao0506
Regular Visitor
8 years ago
Solved

DATEDIFF in Direct Query Mode (32-bit)

When i try to create a calculated column in the power bi (32-bit) in Direct Query mode. I got error on the dax function. I went to settings, but i dont see the option and enable unrest...
  • Anonymous's avatar
    Anonymous
    8 years ago

    wuhao0506,

    Do you use Power BI Desktop August version ? Based on mye test, even we enable unrestricted measures, it is not possible to use DATEDIFF function in calculated columns in DirectQuery mode. However, you can create a measure instead.

    Measure = IF(MAX('Project-Activity'[PLANNED_START_DATE])<'Project-Activity'[DATADATE],DATEDIFF(MAX('Project-Activity'[PLANNED_START_DATE]),'Project-Activity'[DATADATE],DAY),DATEDIFF('Project-Activity'[DATADATE],MAX('Project-Activity'[PLANNED_START_DATE]),DAY))



    Regards,
    Lydia