Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Dear All,
Please help me to write the formula to find the difference between two date columns and then take the average of that.
Below is the sample
LAST_UPDATED_DATE | CREATION_DATE | DAY DIFF | |
10/4/2018 0:00 | 9/30/2018 0:00 | 4 | Average =1.428571429 |
10/1/2018 0:00 | 9/30/2018 0:00 | 1 | |
10/1/2018 0:00 | 9/30/2018 0:00 | 1 | |
10/1/2018 0:00 | 9/30/2018 0:00 | 1 | |
10/1/2018 0:00 | 9/30/2018 0:00 | 1 | |
10/1/2018 0:00 | 9/30/2018 0:00 | 1 | |
10/1/2018 0:00 | 9/30/2018 0:00 | 1 |
Average to be shown in the CARD visual.
Thanks in advance
Solved! Go to Solution.
Calculated Column for DATEDIFF is throwing an error saying "Function DATEDIFF is not allowed as part of calculated Column DAX expressions on DirectQuery models.
So I tried the DATEDIFF with Measure and it's accepting only with aggregate function like MIN,MAX etc,like below
Well, you should be able to create a column:
DAY DIFF = DATEDIFF([LAST_UPDATED_DATE],[CREATION_DATE],DAY)
And then a measure:
Average of DAY DIFF = AVERAGEX('Table',[DAY DIFF])
Calculated Column for DATEDIFF is throwing an error saying "Function DATEDIFF is not allowed as part of calculated Column DAX expressions on DirectQuery models.
So I tried the DATEDIFF with Measure and it's accepting only with aggregate function like MIN,MAX etc,like below
Glad you got it sorted out. Yeah, DirectQuery causes some issues with certain DAX functions.
Hi @Charu
Try this for your measure:
DiffAvg = AVERAGEX ( Table1, Table1[ LAST_UPDATED_DATE] - Table1[CREATION_DATE] )
Hi @AlB
When I create the AverageX measure with two date fields received the below error message
ORA-00904:"t6"."CREATION_DATE":invalid identifier.The exception was raised by the IDbCommand interface
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
76 | |
73 | |
42 | |
36 |
User | Count |
---|---|
109 | |
56 | |
52 | |
48 | |
43 |