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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
laraibashfaq
Regular Visitor

Need help with time intelligence functionality

Hi,

I am creating a measure through which whatever date range is being selected in date filter get the max year for it and calculate the spend for that year for all Qtr's of which data is being present.

Kindly review the below measure which I have created and attachement and please suggest the way forward for it. I need the total spend for Max year disregard the date selected in filter.

 

MaxyearAmount =

VAR MAXyear =

CALCULATE( YEAR( MAX( 'Date'[DateValue] ) ), ALLSELECTED() )

VAR MinDate_MaxYear =

CALCULATE(

MIN( 'Date'[DateValue].[Year] ),

FILTER( 'Date', 'Date'[Year] = MAXyear )

)

VAR MaxDate_MaxYear =

CALCULATE(

MAX( 'Date'[DateValue].[Year] ),

FILTER( 'Date', 'Date'[Year] = MAXyear )

)

VAR MaxyearAmount =

CALCULATE(

[Spend],

FILTER(

'Date',

'Date'[DateValue].[Year] >= MinDate_MaxYear

&& 'Date'[DateValue].[Year] <= MaxDate_MaxYear

)

)

RETURN
MaxyearAmount
Query.jpg
2 REPLIES 2
ALLUREAN
Solution Sage
Solution Sage

Hi, @laraibashfaq 

 

Try something like:

 

MaxyearAmount =
VAR MaxYear =
CALCULATE (
MAX ( 'Date'[DateValue] ),
ALLEXCEPT ( 'Date', 'Date'[DateValue] )
)
RETURN
CALCULATE (
MAX ( [Spend] ),
FILTER (
ALLEXCEPT ( 'Date', 'Date'[DateValue] ),
'Date'[DateValue] = MaxYear
)
)

 

 




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




Nops, this function doesn't work

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.