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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
QQ
Frequent Visitor

Measure to calculate running maximum value per quarter

Your help is much appreciated!

 

I am trying to generate a measure: for each quarter, calculate the maximum value for all quarters before. Here is the table I want to generate on the report:

QuarterCasesMax Quarterly Cases -currentMax Quarterly Cases -Ideal
2010-Q1110110110
2010-Q29090110
2010-Q38080110
2010-Q4120120120
2011-Q1130130130
2011-Q27070130
2011-Q3150150150
2011-Q4140140150
TOTAL890150150

 

The quarters are from calendar table. Both [Cases] and [Max Quarterly Cases] are measures in case table. The cases are recorded by dates in case table and the dates are linked to calendar table. I used [Max Quarterly Cases] = maxx(values(Calendar[Fiscal_Year_Quarter]),[Cases]) and its result shows in Max Quarterly Cases -current. But what I need is the running maximum value as shown in Max Quarterly Cases - Ideal.

 

See some examples online but for calculated column, not for measure. Is there a way to do it using a measure?

 

Thanks a lot!

1 ACCEPTED SOLUTION

Thank you very much Yuliana! Sorry forgot to mention the [Fiscal_year_quarter] column is in text! So Calendar[Fiscal_year_quarter]<=max(Calendar[Fiscal_year_quarter]) does not work.

 

Based on your formula, I used Calculate function and now it is working! Here is the one:

Calculate(Maxx(values(Calendar[Fiscal_Year_Quarter]),[Cases]),Filter(all(Calendar),calendar[date]<=Max(Calendar[Date])))

 

Thanks a lot!

 

View solution in original post

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @QQ,

 

Please try below measure formula:

Max Quarterly Cases =
MAXX (
    FILTER (
        ALLSELECTED ( 'Calendar'[Fiscal_Year_Quarter] ),
        'Calendar'[Fiscal_Year_Quarter] <= MAX ( 'Calendar'[Fiscal_Year_Quarter] )
    ),
    [Cases]
)

3.PNG

 

Best regards,
Yuliana Gu

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

Thank you very much Yuliana! Sorry forgot to mention the [Fiscal_year_quarter] column is in text! So Calendar[Fiscal_year_quarter]<=max(Calendar[Fiscal_year_quarter]) does not work.

 

Based on your formula, I used Calculate function and now it is working! Here is the one:

Calculate(Maxx(values(Calendar[Fiscal_Year_Quarter]),[Cases]),Filter(all(Calendar),calendar[date]<=Max(Calendar[Date])))

 

Thanks a lot!

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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