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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! 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
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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