Forum Discussion
mgrayTCB
Helper IV
4 years agoContext 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] )
mgrayTCB
Helper IV
4 years agoI adjusted them both to use values(project[projectname]) and I still get different answers. The MS Delay Faster does produce the correct averge of the items above but I dont understand why MS Delay produces a different answer. It is always different even with different MS Short Names selected. It is always lower.
SpartaBI
Community Champion
4 years agomgrayTCB 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]
)
- mgrayTCB4 years ago
Helper IV
That did it! Thank very much!
- mgrayTCB4 years ago
Helper 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?
- mgrayTCB4 years ago
Helper IV
Thanks again for digging in to this. Unfortunatly that addtional calculate did not help