The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
Need some help with DAX measure to calculate running elapsed time in hours for each records since its created timestamp.
The ask is two fold.
* First one is when this measure is added to a table, it should show elapsed time in hours for each row as of Now.
* Second one is when this measure is added to a card visual, it should show average elapsed time in hours for all applicable rows as filtered.
Data Table:
The Elapsed Time calculation should be in hours "createdon - Now()" and should keep updating when the visual is updated using the current date/time (Now()).
If this same Measure is used in, lets say "Card Visual", it should show Average of elapsed time for all the records.
Solved! Go to Solution.
[Avg Elapsed Time until Now] =
AVERAGEX(
T,
var Created_ = T[Created On]
var Now_ = NOW()
var SecondsPerHour = 60 * 60
RETURN
DATEDIFF(SECOND, Created_, Now_) / SecondsPerHour
)
Something like this? If you want even greater precision, you could try to calculate using milliseconds... but I doubt you'd want to even go down to the seconds. Minutes would probably do as well.
[Avg Elapsed Time until Now] =
AVERAGEX(
T,
var Created_ = T[Created On]
var Now_ = NOW()
var SecondsPerHour = 60 * 60
RETURN
DATEDIFF(SECOND, Created_, Now_) / SecondsPerHour
)
Something like this? If you want even greater precision, you could try to calculate using milliseconds... but I doubt you'd want to even go down to the seconds. Minutes would probably do as well.
This works great for both of my scenarios. Thank you so much!
User | Count |
---|---|
28 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
35 | |
14 | |
12 | |
9 | |
7 |