Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
Hi everybody,
I have 2 colonnes says DateA and DateB with date format. If I create another C Column = DateA -DateB, it works.
I have many average date difference to calculate, so I would like to create Measures instead of Columns.
But I can't get this result.
When I use Measure = datediff(, I can't use columns, I understand that it doesn't know what level I am, I need to use an agregation like min() ?
Can someone please help me understand why it doesn't work. I want to make a calculation like :
measure = AVERAGEX(DATEDIFF(DateA, DateB, DAY))
Thanks in advance,
Solved! Go to Solution.
@BTRD Hi!
The main issue is that Measures operate in an aggregated context. The DATEDIFF function expects specific date values, but Measures don't know which rows to calculate on unless you use aggregations or iterate over the table using functions like AVERAGEX.
you can use this measure:
Measure =
AVERAGEX(
YourTableName,
DATEDIFF(YourTableName[DateA], YourTableName[DateB], DAY)
)
if you provide me sample data and the expected result i can help you.
BBF
Hi BeaBF, thanks a lot for your explanation and help ! It works perfectly, yes !
@BTRD Hi!
The main issue is that Measures operate in an aggregated context. The DATEDIFF function expects specific date values, but Measures don't know which rows to calculate on unless you use aggregations or iterate over the table using functions like AVERAGEX.
you can use this measure:
Measure =
AVERAGEX(
YourTableName,
DATEDIFF(YourTableName[DateA], YourTableName[DateB], DAY)
)
if you provide me sample data and the expected result i can help you.
BBF
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
15 | |
11 | |
8 | |
8 | |
8 |
User | Count |
---|---|
23 | |
13 | |
11 | |
10 | |
10 |