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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
jj1
Helper II
Helper II

datediff dax -formula

hi im trying to use a simple datediff dax formula to obtain the sla difference in terms of calendar days between two date columns in the table- it should be very easy but when i selectthe datediff function-it is not giving the option to select the table from the query for th two date columns) normally any dax formula new calculation allows that . any ideas why it wont allow or show the selection as i type the datediff formula? 

1 ACCEPTED SOLUTION

this is sovled-rather than using a new measure in the report view- i used dax datediff in the data(table view) and datediff works just fine to get sla from one date compared to another (calendar days for this purpose) and can be set for hours or weeks or days-i chose days and sla achieved via dax date diff after all--closing this one as solved- thanks all

jj1_0-1724563205618.png

 

View solution in original post

14 REPLIES 14
jj1
Helper II
Helper II

jj1_5-1724455609979.pngjj1_6-1724455652738.png

so as i write the dax formula-it is not allowing me to select the activitypointer query and select the tables to calculate) normally dax formulas always allow this for me or anyone

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

jj1
Helper II
Helper II

so the report view is not giving the minute or hour maybe i need to add a new field idk? but the table view is giving that and i think that is why datediff wont recognize the table inthe query or allow me to select it

jj1
Helper II
Helper II

jj1_0-1724455183062.png

jj1_1-1724455218644.png

 

jj1_4-1724455317805.png

 

 

jj1
Helper II
Helper II

the issue is in the table the date is listed as long form month day and hour and minute but when i move to the report it gives me in the date table only month and day and year and quarter so i guess since the report is not showing the hour and minute as in the table then it wont activate the normal datediff identifier 

That's not the reason.  Look at the DAX code before that spot.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Created Date MonthCreated Date DayReply Date MonthReply Date Day
Jan20Jan22
April21April 25

Create DateReply date
1/2/24 905am1/5/24 912pm

so when i use sla-datediff- it is not recognizing the columns and so instead of offering me the selection to click the table in the query to enter values for sal dax date difference instead it does nothing- same if i use datesbetween dax etc or bus day sla

Datediff requires scalar attributes. You cannot use it with columns.

oh i see tha texplains it-dax formual DateDiff is not able to leverage columns data-ok so what is simplest way to do the dax calculcation within the query or table to establish bus day or claendar day sla between the two date columns? 

change your calculation to a calculated column (since the data is likely immutable)  or if you need to use a measure then aggregate the data somehow, with SELECTEDVALUE or equivalent.

this is sovled-rather than using a new measure in the report view- i used dax datediff in the data(table view) and datediff works just fine to get sla from one date compared to another (calendar days for this purpose) and can be set for hours or weeks or days-i chose days and sla achieved via dax date diff after all--closing this one as solved- thanks all

jj1_0-1724563205618.png

 

lbendlin
Super User
Super User

It will not show the Intellisense hints if you have an error in a previous part of your formula.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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