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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

30-Day Average as bubble size

I am trying to create a 30-day average by entity that i'd like to use categorically with the intent to use it as a bubble size or in grouping for a historgram chart. When I try and create the measure using my date field, it seems the metric only works with the date field being used in the graph or chart. How can I get around this?

1 ACCEPTED SOLUTION

HI @Anonymous,

You can try to use below measure formula to calculate rolling 30day average:

Rolling 30day Average =
VAR currDate =
    MAX ( Table[Date] )
RETURN
    CALCULATE (
        SUM ( Table[Oil Volume] ),
        FILTER ( ALLSELECTED ( Table ), [Date] >= currDate - 30 && [Date] <= currDate ),
        VALUES ( Table[Well] ),
        VALUES ( Table[Battery] )
    )

BTW, if you want to create a bin of rolling average range, you need to use the calculate column instead, measure formula not able to use as category/group to expand records. (calculate column/table not able dynamic interact with filter/slicers)

Calculate column version:

Rolling 30day Average =
CALCULATE (
    SUM ( Table[Oil Volume] ),
    FILTER (
        ALLSELECTED ( Table ),
        [Date]
            >= EARLIER ( Table[Date] ) - 30
            && [Date] <= EARLIER ( Table[Date] )
            && Table[Well] = EARLIER ( Table[Well] )
            && Table[Battery] = EARLIER ( Table[Battery] )
    )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

You can try like with Date dimension

 

Rolling 30 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],MAX(Sales[Sales Date]),-30,Day))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

Greg_Deckler
Super User
Super User

Very difficult to say. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

WellBatteryDateOil Volume
Well ABattery A1/1/20201000
Well ABattery A1/2/20201100
Well ABattery A......
Well ABattery A3/24/2020500
Well BBattery B1/1/2020700
Well BBattery B1/2/2020800
Well BBattery B... 
Well BBattery B3/24/2020300

 

Essentially I have a data table like the above. I need to calculate a 30-day average. I tried using the quick measures but couldn't get the measure to report anything in a timeless visualization. My goal is to take the Battery name with their lat/longs and plot on ArcGIS the Batteries with their respective 30-day average as a point size. 

 

I'd also like to utilize the measure in a histogram where I can bin the measure in different bands 0-100, 100-500, 500-1000, 1000-2000, 2000+ for example. 

HI @Anonymous,

You can try to use below measure formula to calculate rolling 30day average:

Rolling 30day Average =
VAR currDate =
    MAX ( Table[Date] )
RETURN
    CALCULATE (
        SUM ( Table[Oil Volume] ),
        FILTER ( ALLSELECTED ( Table ), [Date] >= currDate - 30 && [Date] <= currDate ),
        VALUES ( Table[Well] ),
        VALUES ( Table[Battery] )
    )

BTW, if you want to create a bin of rolling average range, you need to use the calculate column instead, measure formula not able to use as category/group to expand records. (calculate column/table not able dynamic interact with filter/slicers)

Calculate column version:

Rolling 30day Average =
CALCULATE (
    SUM ( Table[Oil Volume] ),
    FILTER (
        ALLSELECTED ( Table ),
        [Date]
            >= EARLIER ( Table[Date] ) - 30
            && [Date] <= EARLIER ( Table[Date] )
            && Table[Well] = EARLIER ( Table[Well] )
            && Table[Battery] = EARLIER ( Table[Battery] )
    )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.