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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply

Accumulate last 12 month of a formula

Hi Community!

 

I am having a problem with a formula and I dont understand why, because it works in others dashboards.

 

Situation: I have only one database, which has the column measure, value and date. All columns with the correct format.

What I need to do is to accumulate the formula "Turnover" of the last 12 month (It is the Turnover MAT)

And show the Turnover MAT of each month of the last year.

 

So I did this:

MAT Turnover = CALCULATE([Turnover],ALL('Database'[Fecha]),DATESINPERIOD('Database'[Fecha],LASTDATE('Database'[Fecha]),-12,MONTH))

 

This formula returns the same number as the formula Turnover.

can someone help me? thanks!!!

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @MariaFlorenciaB 

 

I'd like to suggest you create a date table called 'Calendar' with CALENDAR()  or CALENDARAUTO() and then create a relationship with the fact table.

 

Then you may try the following measure to see if it helps.

MAT Turnover =
CALCULATE (
    [Turnover],
    DATESINPERIOD ( 'Calendar'[Date], LASTDATE ( 'Calendar'[Date] ), -12, MONTH )
)

 

Best Regards

Allan

 

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

amitchandak
Super User
Super User

@MariaFlorenciaB , Try to use date table in all such case, example like

 

Rolling 12 = CALCULATE([Turnover],DATESINPERIOD('Date'[Date],ENDOFMONTH(Database[Fecha]),-12,MONTH))
Rolling 12 = CALCULATE([Turnover],DATESINPERIOD('Date'[Date ],MAX(Database[Fecha]),-12,MONTH))
Rolling 12 = CALCULATE([Turnover],DATESINPERIOD('Date'[Date ],MAX('Date'[Date]),-12,MONTH))

 

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.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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