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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

The MAX function only accepts a column reference as an argument

While creating calcualted column:

could youplease help me how to use max for single values.... max accepts only column instead of value 

 

_MeqY2 =
// then If(([USAGE_DATE]<=Max(DateAdd("dd",Day(DateTimeNow()),[SelectedMonthYear]))) and ([USAGE_DATE]>=Max(DateAdd("mm",-5,DateTimeNow()))),"Y","N")

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)


// DateAdd("dd",Day(DateTimeNow()),[SelectedMonthYear]))

 

thimmaraju_0-1638977209592.png

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

while creating measure : usagedate is not accepting 

thimmaraju_0-1638978302135.png

 

 

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous 

 

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

 

Try this:

 

_MeqY2 =
VAR adddays =
    DAY ( TODAY () ) + [_SelectedMonthYear]
VAR last5 =
    DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 5, 1 )
RETURN
    IF (
        'Usage Tracking'[USAGE_DATE] <= adddays
            && '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.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

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

@amitchandak  or @VahidDM  could you please help me on this code

 

Hi @Anonymous 

 

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

 

Try this:

 

_MeqY2 =
VAR adddays =
    DAY ( TODAY () ) + [_SelectedMonthYear]
VAR last5 =
    DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 5, 1 )
RETURN
    IF (
        'Usage Tracking'[USAGE_DATE] <= adddays
            && '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.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.