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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
water-guy-5
Helper III
Helper III

Calculate the last 90 days average

Hello, 

Although using a date slicer would be great, I am trying to capture a specific number using a measure.

What I have so far is a measure that reads the daily average and gives me a usage per minute value. I use usage (divided by 1000) and run time. We can call this DailyAverage. This converts usage to 1000s and hours ran to minutes.

DailyAverage =
Var Usage = SUM(Table[Usage]) * 1000
Var RunTime = SUM(Table[HoursRan]) * 60
Return
DIVIDE(Usage,Runtime)

I have a date column called Table[Date] where I want to calculate the daily readings from the last 90 days and find an average. How would this measure look?

CALCULATE(AVERAGE(Table[DailyAverage]), Date Function I am having trouble with)

Thanks in advance!


1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@water-guy-5 Maybe:

Measure = 
  VAR __Table = 
    ADDCOLUMNS(
      FILTER(Table[Date], [Date] >= TODAY()-90),
      "__DailyAverage",[DailyAverage]
    )
RETURN
  AVERAGEX(__Table, [__DailyAverage])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

@water-guy-5 Maybe:

Measure = 
  VAR __Table = 
    ADDCOLUMNS(
      FILTER(Table[Date], [Date] >= TODAY()-90),
      "__DailyAverage",[DailyAverage]
    )
RETURN
  AVERAGEX(__Table, [__DailyAverage])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.