Forum Discussion
mgrayTCB
4 years agoHelper IV
Context transition with variable
when i calculate this average with two separate measures it works correctly but when I try to combine it into one meaure with an extra variable it stops working correctly. I am trying to calculate th...
- 4 years ago
mgrayTCB try this:
MS Months Chg2 = AVERAGEX ( FILTER ( ADDCOLUMNS ( Project, "@datechg", VAR SSdate = CALCULATE ( MINX ( MilestoneSS, MilestoneSS[DateActOrEstSS] ) ) VAR Curdate = CALCULATE ( MAXX ( Milestones, Milestones[DateActOrEst] ) ) VAR datechg = DATEDIFF ( SSdate, Curdate, DAY ) / 30.4 RETURN datechg ), [@datechg] <> 0 ), [@datechg] )
SpartaBI
4 years agoCommunity Champion
mgrayTCB try this:
MS Months Chg2 =
AVERAGEX (
FILTER (
ADDCOLUMNS (
Project,
"@datechg",
VAR SSdate =
CALCULATE ( MINX ( MilestoneSS, MilestoneSS[DateActOrEstSS] ) )
VAR Curdate =
CALCULATE ( MAXX ( Milestones, Milestones[DateActOrEst] ) )
VAR datechg =
DATEDIFF ( SSdate, Curdate, DAY ) / 30.4
RETURN
datechg
),
[@datechg] <> 0
),
[@datechg]
)
mgrayTCB
4 years agoHelper IV
Thank you so much! I was wondering about performance and before I could even test it in my model you rewrote it. I have never seen the "@" syntax. Is that just your convention for columns of virutal tables?
thanks again!