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
andychu221
Frequent Visitor

Minimum of rolling 12 month sum

Dear all,

 

I want to calculate the minimum value of rolling 12 month return for the following data set

Q1.JPG

 

I use the following code to calculate rolling 12 return and it can calculate the result correctly.

 

 

Rolling12M = 
CALCULATE(
SUM(DataBase[Return]),
DATESINPERIOD(
                DataBase[Date],
                LASTDATE(DataBase[Date]),
                -12,
                MONTH
)
)

 

 

However, i use MINX to calculate min value of rolling 12m return, but it return the min value of single month return

my code is as follows:

 

 

MaxDD = MinX(Database,[Rolling12M])

 

 

For example, I use [Rolling12M] code to calculate EUR Rolling12M return and the graph show minimum value is -24.39%

But when i use [MaxDD] code to calculate min value of [Rolling12M], it shows -7.39% (worst month return)

 

擷取.JPG

 

Does anyone can help me?

Thanks!

 

 

 

 

2 ACCEPTED SOLUTIONS
andychu221
Frequent Visitor

 

 I use the following code to solve the problem temporary. However, the -120 is manual. Can i dynamic get the count between lastmonth and firstmonth? 

MaxDD = MINX(DATESINPERIOD(DataBase[Date],LASTDATE(DataBase[Date]), -120, MONTH),[Rolling12M])

 

擷取.JPG

View solution in original post

I use the following code to solve the issue. 

 

MonthCount = CALCULATE (COUNT ( Database[Date] ),FILTER (ALLSELECTED ( Database ),Database[Date]  <= MAX ( Database[Date] )))

View solution in original post

4 REPLIES 4
andychu221
Frequent Visitor

 

 I use the following code to solve the problem temporary. However, the -120 is manual. Can i dynamic get the count between lastmonth and firstmonth? 

MaxDD = MINX(DATESINPERIOD(DataBase[Date],LASTDATE(DataBase[Date]), -120, MONTH),[Rolling12M])

 

擷取.JPG

Anonymous
Not applicable

Hi,

 

I'm looking for exactly the same but than the minimum on month base and not on day base.

Any idea?

 

Kr,

 

Valérie

I use the following code to solve the issue. 

 

MonthCount = CALCULATE (COUNT ( Database[Date] ),FILTER (ALLSELECTED ( Database ),Database[Date]  <= MAX ( Database[Date] )))

Hi @andychu221,

It's pleasant that your problem has been solved, could you please mark your reply as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.