cancel
Showing results for
Did you mean:
Anonymous
Not applicable

## The MAX function only accepts a column reference as an argument

While creating calcualted column:

_MeqY2 =

var adddays = DAY(TODAY()) + [_SelectedMonthYear]
var last5 = DATE(YEAR(TODAY()), MONTH(TODAY())-5,1)
return
IF( 'Usage Tracking'[USAGE_DATE] <= MAX(adddays) && 'Usage Tracking'[USAGE_DATE] >= MAX(last5),1,0)

-==================

while creating measure : usagedate is not accepting

1 ACCEPTED SOLUTION
Super User

Hi @Anonymous

You don't need to use MAX in your dormula, remove Max and just type your Variable names.

Try this:

``````_MeqY2 =
DAY ( TODAY () ) + [_SelectedMonthYear]
VAR last5 =
DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 5, 1 )
RETURN
IF (
&& 'Usage Tracking'[USAGE_DATE] >= last5,
1,
0
)``````

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

3 REPLIES 3
Anonymous
Not applicable

@VahidDM  you are right, but if i want to find the MAX variables days and  last 6 months, then how to do it? im using max as per migration project code....

using this calculated column i have write another final calculation based on

_MeqY2 cals

you are solution works superb...

Anonymous
Not applicable

Super User

Hi @Anonymous

You don't need to use MAX in your dormula, remove Max and just type your Variable names.

Try this:

``````_MeqY2 =
DAY ( TODAY () ) + [_SelectedMonthYear]
VAR last5 =
DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 5, 1 )
RETURN
IF (
&& 'Usage Tracking'[USAGE_DATE] >= last5,
1,
0
)``````

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.