Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using DATEADD and NOW() together

Tags:

dax

If I try adding the following Measure into my DimDate table:

Past6Months = 
IF(
    FIRSTDATE(  'Dates'[FullDate] ) >= DATEADD( NOW(), -7, MONTH ),
    TRUE(),
    FALSE()
    )

I get this error:

The first argument to 'DATEADD' must specify a column.

like image 284
whytheq Avatar asked Oct 31 '22 05:10

whytheq


1 Answers

What also works: do what DAX is asking you to do. First put TODAY in a column and than refer to that column.

TodayColumn = TODAY()

Past6Months = 
IF(
    FIRSTDATE(  'Dates'[FullDate] ) >= DATEADD( 'MyTable'[TodayColumn], -7, MONTH ),
    TRUE(),
    FALSE()
    )
like image 144
WalTig Avatar answered Jan 04 '23 13:01

WalTig