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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join 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
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

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.