Forum Discussion
Trying to get Max value using a column parameter
Hi Irwan ,
I tried the expression you provided, it gives me the 'MAX' for all the rows in the dataset.
So in my dataset I have a column 'MONTH' and 'YEAR' and I need to get a calculated column that gives me 1 for 'MAX' month and 'MAX' year, and 0 for all the remainder rows. The current dataset got max year as 2025 and max month as 5, and in my column I need 1 for MAX year 2025 and MAX month 5 and 0 for remainder of the rows. This should switch when the June data is added to the dataset.
I hope I have clarify the ask.
Thanks,
Ali.
hello aliahad
i assumed you want to get MAX value of your date (max month AND max year).
Here is a simple example.
Check =
var _Max = MAX('Table'[Date])
Return
IF(
'Table'[Date]=_Max,
1,
0
)
but if you need separate column between month and year, then please try this.
Check Month =
var _Max = MAX('Table'[Month])
Return
IF(
MONTH('Table'[Date])=_Max,
1,
0
)
Check Year =
var _Max = MAX('Table'[Year])
Return
IF(
YEAR('Table'[Date])=_Max,
1,
0
)
Hope this will help.
Thank you.