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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

How to display Average Age of a variable over time (time between fixed start date and today)

I have a dataset where each row represents an alarm and each has a particular start date.

 

I can easily calculate the current average age of my alarms by making a custom column = DATEDIFF(AlarmStartDate,today())  and show it in a Card visualization, summarizing as Average.

 

However, I'm also trying to display the average age of alarms over time as a line chart (where the x axis is time.) What I would need to do is calculate the average age of alarms on all past dates, which would require somehow using that day's date as the end date in DATEDIFF instead of using TODAY().

This picture is what I would like - I made this in a Google Sheet. The average age of alarms increases every day until a new alarm starts - that's where the average drops down.)

 

AvgAlarmAge2.PNG

 

It's sort of a rolling average, but not exactly - only the end date 'rolls' and there are no periods. I also tried a MTD measure, but that ends up calculating only the average age of alarms for those with AlarmStartDates within the particular month on the X axis.

Is it possible to do this? Feel like I'm maybe missing something obvious. Thanks!

7 REPLIES 7
Anonymous
Not applicable

Hi @Anonymous ,

 

I need 1 clarification, Could you please make a rough line chart(in excel or paper) with the sample data that will be helpful to understand your scenario(Mainly X-axis).

Or as @Icey mentioned you can add pbix file too.

 

 

Best Regards,

Ravi

Anonymous
Not applicable

@Anonymous and @Icey  does this help?

Each bar represents the average of all alarms' age on that particular day. When the bars drop, that indicates that a new alarm just started that day, thus lowering the average. (Note: there are no alarms before 11/2017) 

 

AvgAlarmAge2.PNG

(link to spreadsheet)

 

To make this chart in a spreadsheet:

1. Made a DateDim column from 1/1/2017-9/20/2019

2. Made a column for each alarm

3. Did a DATEDIFF calculation for each alarm on every row (start = AlarmStartDate, end = current row of DateDim), so that on the row that the alarm starts, there is a 1, the next day a 2, and so on

4. Made a column at the end that averages the whole row of datediff results, so that each row in my table has a number corresponding to the average age of all alarms on that particular date

5. Plotted the column of averages against the DateDim column

 

I'll be back to my pc next Monday and will be able to reply then. Thanks for the help!

Anonymous
Not applicable

It's Quite Clear now but Could you please allow write access to the spreadsheet:

my email: ravik4934@gmail.com

Anonymous
Not applicable

Hi @Anonymous, any progress on the calculation?

Icey
Community Support
Community Support

Hi @Anonymous ,

If you do not mind, please give me an example PBIX file.

 

Best Regards,

Icey

Anonymous
Not applicable

Sure thing @Anonymous , added in OP and here it is:

https://drive.google.com/open?id=1j62hqy44ft7C7eQuAp3CYoz__dpeE-Wh 

Anonymous
Not applicable

Hi @Anonymous 

 

Could you please attach a sample dataset. It will be helpful for test cases.

 

Best Regards,

Ravi

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors