5
votes

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.

2
May be DATEADD(MONTH, -7, NOW())? At least this is how it should be written in SQL Server. - Giorgi Nakeuri
@GiorgiNakeuri - other way around in DAX: msdn.microsoft.com/en-us/library/ee634905.aspx - whytheq

2 Answers

2
votes

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()
    )
0
votes

Try this

Past6Months =
IF (
  FIRSTDATE ( v_Dim_Tid[Dato] )
  >= DATE ( YEAR ( NOW () ), MONTH ( NOW () ) - 7, DAY ( NOW () ) ),
  TRUE,
  FALSE
)