Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
wuhao0506
Regular Visitor

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.

datediff.pngoptions.pngoptions.png

I went to settings, but i dont see the option and enable unrestricted measures.

 

Can anyone help on this?

 

Thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@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))

1.PNG

Regards,
Lydia

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@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))

1.PNG

Regards,
Lydia

Anonymous
Not applicable

I thing this is unnacceptable solution, since making this a calculation will restrict your later transformations. I'm trying for over a week to do this calculation for a calculated column and it seems impossible. Why you do that, Microsoft?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.