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 can you test this scenario and put it also in the visual:
MS Months Chg2 Wrong =
AVERAGEX (
ADDCOLUMNS (
VALUES('Project'[ProjectName]),
"@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]
)
mgrayTCB
4 years agoHelper IV
That seems to be averaging in zeros. You are no longer limiting the virtual table to datechg <> 0. Why is that not working in the version without the virtual column?