PDA

View Full Version : Dax Expression with Variable v Hardcoded



MikeManwaring
2016-08-04, 07:59 AM
Hi All

i am having difficulty understanding why the following does not work. i have read many articles on variables and do not see why this would makes a difference.


this formula gives me 8 = MONTH(LASTDATE(OrderLines[OrderDate]))

if i put this formula below instead of the hardcoded 8 the measure does not work. where it works ok with hardcoded 8?

CumulativeExVAT =
var cmonth = 8
var cyear = 2016

RETURN

CALCULATE (
SUM ( OrderLines[ExVatValue] )
, FILTER (
ALL ( DimDates ),
DimDates[Day] <= MAX ( DimDates[Day] )
&& DimDates[Month Number] = cmonth
&& DimDates[Year] = cyear
)
)


thanks for any advice
Mike

MikeManwaring
2016-08-04, 09:17 AM
this is sorted now :)