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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SteelChampzz
Helper II
Helper II

Rolling Average with just the MONTHS

I have data that shows only Months (NO DATES) and the Amount.

SteelChampzz_0-1668720092458.png

There are stores/company names also in the data (I can not show store information)

I'm trying to create a Rolling Average for the last 11 months (Jan-Nov) in DAX.

 

I'm a little confused of how I would create this measure.

All help would be appreciated

 

Thanks everyone

 

1 ACCEPTED SOLUTION
Mikelytics
Resident Rockstar
Resident Rockstar

Hi @SteelChampzz 

 

Please find below a solution:

 

Disclaimer: in the following appraoch I might solve your challenge but in genereal I recommend you to get in touch with the following principles:

star schema data model: Understand star schema and the importance for Power BI - Power BI | Microsoft Learn

Date Dimension Table: Creating a simple date table in DAX - SQLBI

Typically You would transform the month columns into dates like Nov -> 11/01/20xxx and so on and then you would work with the date dimension to do something liek I describe in the measure below. 

 

But to answer your question I go on with an approach to your questions. 🙂

 

Solution:

 

exemplary table to be rolled up

Mikelytics_0-1668720618633.png

 

Create a mapping table in Power Query

Mikelytics_1-1668720648038.png

Mikelytics_2-1668720730985.png

 

Do a merge between the table

Mikelytics_4-1668720973495.png

Mikelytics_6-1668721016116.png

Extend the table

Mikelytics_8-1668721060983.png

Mikelytics_9-1668721105073.png

 

Load the data into the data model and then change the sorting settings:

Mikelytics_11-1668721249470.png

so that the month columns is sort by number instead of month

Mikelytics_12-1668721270605.png

Please go in the report view and build the following measure:

 

Measure = 
CALCULATE(
    SUM(Table_1[Amount]),
    FILTER(
        ALL(Table_1),
        Table_1[Number] <= MAX(Table_1[Number])
    )
)

Mikelytics_13-1668721491323.png

 

Please put column Month and the measure in a table visual:

 

Mikelytics_14-1668721575029.png

 

Best regards

Michael

-----------------------------------------------------

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!

@ me in replies or I'll lose your thread.

 

 

 

 

 

 

 

 

 

 

 

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

View solution in original post

5 REPLIES 5
Mikelytics
Resident Rockstar
Resident Rockstar

@SteelChampzz  You're welcome and I am happy to help 🙂

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

Also How would I filter my store names into the measure?
Sorry for the extra question, just want to get a clear understanding lol

 

Mikelytics
Resident Rockstar
Resident Rockstar

Hi @SteelChampzz 

 

Please find below a solution:

 

Disclaimer: in the following appraoch I might solve your challenge but in genereal I recommend you to get in touch with the following principles:

star schema data model: Understand star schema and the importance for Power BI - Power BI | Microsoft Learn

Date Dimension Table: Creating a simple date table in DAX - SQLBI

Typically You would transform the month columns into dates like Nov -> 11/01/20xxx and so on and then you would work with the date dimension to do something liek I describe in the measure below. 

 

But to answer your question I go on with an approach to your questions. 🙂

 

Solution:

 

exemplary table to be rolled up

Mikelytics_0-1668720618633.png

 

Create a mapping table in Power Query

Mikelytics_1-1668720648038.png

Mikelytics_2-1668720730985.png

 

Do a merge between the table

Mikelytics_4-1668720973495.png

Mikelytics_6-1668721016116.png

Extend the table

Mikelytics_8-1668721060983.png

Mikelytics_9-1668721105073.png

 

Load the data into the data model and then change the sorting settings:

Mikelytics_11-1668721249470.png

so that the month columns is sort by number instead of month

Mikelytics_12-1668721270605.png

Please go in the report view and build the following measure:

 

Measure = 
CALCULATE(
    SUM(Table_1[Amount]),
    FILTER(
        ALL(Table_1),
        Table_1[Number] <= MAX(Table_1[Number])
    )
)

Mikelytics_13-1668721491323.png

 

Please put column Month and the measure in a table visual:

 

Mikelytics_14-1668721575029.png

 

Best regards

Michael

-----------------------------------------------------

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!

@ me in replies or I'll lose your thread.

 

 

 

 

 

 

 

 

 

 

 

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

Hey Mike,

I'm also curious to know if this is a Rolling AVERAGE or Rolling TOTAL measure?

To me, my assumption would think that this is a Rolling total, if the terminology is different it would be great help to get an understanding on this

Thank you for the help on this, I was stuck for sure.
I appreciate you doing the step-by-step

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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