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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Calculate MAX Date based year context

Hello, 

 

I need some help embedding the Financial year context into a DAX measure:

 

The below measure understandably brings back P13 21/22 as im asking for the MAX Number, im unsure as to how to add in year/financial year context as the correct Max_period should be P04 22/23?

 

Max_Period = 


var Max_Period = calculate(MAX('Alex Date Period Flow'[Period - Numbered]), ALLSELECTED('Alex Date Period Flow'))

return Max_Period

 

 

finno14_0-1655130698877.png

 

Any assistance would be greatly appreciated.


Thank you!

 

Alex

 

1 ACCEPTED SOLUTION

If the slicer you are using is also coming from the date table then I think the below should work

Max Period = SELECTCOLUMNS( TOPN(1, 'Date', 'Date'[Date]), 'Date'[Period])

View solution in original post

6 REPLIES 6
johnt75
Super User
Super User

You can use TOPN, something like

Max Period = SELECTCOLUMNS( TOPN(1, 'Table', 'Table'[Fin Year Period]), 'Table'[Period number])

You may need to change the [Fin Year Period] column to instead be whichever column is providing the Sort Order for that column

Anonymous
Not applicable

Hi @johnt75 ,

 

Thank you for taking the time to respond, greatly appreciated!

 

I'm struggling to get the formula to work, below is my current date table for context. Does my Financial year need to be amended into a whole number? 

 

finno14_0-1655201467123.png

Kind regards,

 

If the slicer you are using is also coming from the date table then I think the below should work

Max Period = SELECTCOLUMNS( TOPN(1, 'Date', 'Date'[Date]), 'Date'[Period])
Anonymous
Not applicable

Hi John, 

 

This formula was spot on, I was trying to display it in a card with a filter within it *Facepalm*

 

Thank you for your help! Lifesaver!!!

 

Alex

Anonymous
Not applicable

Good Morning John,

 

Apologies, I do not mean to be frustrating however I cannot seem to make the code viable... I have attached below so you can see where im going wrong. Apologies again havent too much experience working with TOPN(

 

Max Period = 


  SELECTCOLUMNS(
TOPN(1,'Alex Date Period Flow','Alex Date Period Flow'[Date])
," Select Column requires a name after ( ", 'Alex Date Period Flow'[Period])

That looks OK to me. What results are you seeing? Is it possible to share a sample PBIX ?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors