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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@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

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@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

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.