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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
kalpesh07
Frequent Visitor

Rolling Period

Hi All,
I need help with Calculating on Rolling period Basis. MAT means last 12 Month.
So I've to calculate Sales% basis Last 12 month for every month like

Jan'24 MAT (Feb23-Jan24)
Feb'24 MAT (Mar23-Feb'24)
Mar'24 MAT (Apr23-Mar24)

I've already created a measure Sales% = Sales/Total sales.
How to create  MAT SALES% measure so whatever month is selected, it calculate basis last 12 month value.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @kalpesh07 

Thanks for @bhanu_gautam reply. Here is the complementary method, which still primarily utilizes the time-intelligent function.

vyaningymsft_2-1720418460924.png

Measure:

%Sales = 
VAR _dateEnd =
    SELECTEDVALUE ( 'Table'[Date] )
VAR _dateEndDay =
    DAY ( _dateEnd ) + 1
VAR _dateStart =
    EOMONTH ( _dateEnd, -13 ) + _dateEndDay
VAR _monthStart =
    EOMONTH ( _dateEnd, -2 ) + _dateEndDay
VAR _TotalSales =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        'Table'[Date] >= _dateStart
            && 'Table'[Date] <= _dateEnd
    )
VAR _MonthSales =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        'Table'[Date] >= _monthStart
            && 'Table'[Date] <= _dateEnd
    )
VAR _result =
    DIVIDE ( _MonthSales, _TotalSales )
RETURN
    _result

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum


 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi, @kalpesh07 

Thanks for @bhanu_gautam reply. Here is the complementary method, which still primarily utilizes the time-intelligent function.

vyaningymsft_2-1720418460924.png

Measure:

%Sales = 
VAR _dateEnd =
    SELECTEDVALUE ( 'Table'[Date] )
VAR _dateEndDay =
    DAY ( _dateEnd ) + 1
VAR _dateStart =
    EOMONTH ( _dateEnd, -13 ) + _dateEndDay
VAR _monthStart =
    EOMONTH ( _dateEnd, -2 ) + _dateEndDay
VAR _TotalSales =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        'Table'[Date] >= _dateStart
            && 'Table'[Date] <= _dateEnd
    )
VAR _MonthSales =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        'Table'[Date] >= _monthStart
            && 'Table'[Date] <= _dateEnd
    )
VAR _result =
    DIVIDE ( _MonthSales, _TotalSales )
RETURN
    _result

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum


 

bhanu_gautam
Super User
Super User

@kalpesh07 , You can achieve this by using DAX measures in Power BI

 

First make sure you have a date table in your model, if not than create one using 

DateTable =
    ADDCOLUMNS (
        CALENDAR (DATE(2020, 1, 1), DATE(2030, 12, 31)),
        "Year", YEAR([Date]),
        "Month", MONTH([Date]),
        "MonthName", FORMAT([Date], "MMMM"),
        "YearMonth", FORMAT([Date], "YYYYMM")
    )
 
Then create a sales measure

TotalSales = SUM(Sales[SalesAmount])
 
Then create a sales percentage measure

SalesPercentage = DIVIDE([TotalSales], CALCULATE([TotalSales], ALL(Sales)))
 
In Last create a new measure as Mat sales %

MAT Sales% =
VAR CurrentDate = MAX(DateTable[Date])
VAR StartDate = EDATE(CurrentDate, -11) -- 11 months back from the current month
RETURN
CALCULATE(
[SalesPercentage],
DATESBETWEEN(DateTable[Date], StartDate, CurrentDate)
)



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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