Forum Discussion
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
Any assistance would be greatly appreciated.
Thank you!
Alex
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])
6 Replies
- johnt75Super 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
- AnonymousNot 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?
Kind regards,
- johnt75Super User
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])