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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
David_Marks
Frequent Visitor

creating moving measure of the last 12 months without accumulating.

I need a measure that returns me the last 12 months of my base, but without accumulating. For example, if the base have 16 months, it only returns the last 12 months. it would be another moving measure always bringing the last 12 months. But if in my base have just 5 months will bring me just 5 months and when i have 12 months or more, it will bring me 12 months always 12 last months.

1 ACCEPTED SOLUTION
David_Marks
Frequent Visitor

i created this measure and it worked for me i'm posting here to help other people with the same problem, but thank you for all the help.

CALCULATE(
    [Valor Consumo],
    DATESINPERIOD(
        dData[Data],
        LASTDATE(dData[Data]),
        -12,
        MONTH),
    VALUES(dData[Nome do Mês])
)

View solution in original post

2 REPLIES 2
David_Marks
Frequent Visitor

i created this measure and it worked for me i'm posting here to help other people with the same problem, but thank you for all the help.

CALCULATE(
    [Valor Consumo],
    DATESINPERIOD(
        dData[Data],
        LASTDATE(dData[Data]),
        -12,
        MONTH),
    VALUES(dData[Nome do Mês])
)
amitchandak
Super User
Super User

@David_Marks , Based on what I got,

First, create a measure

Avg 1 = averageX(Values('Date'[Month Year]), calculate(SUM(Sales[Sales Amount])))

 

then try

Cumm Sales = CALCULATE([Avg 1],filter(allselected(date),date[date] <=max(date[Date])))

 

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 :radacad sqlbi My Video Series Appreciate your Kudos.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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