Forum Discussion
Anonymous
4 years agoNot applicable
Calculate average by week base on a date
Hi everybody, I am trying to calculate an average by week based on a date. My data table is about alerts from servers Some of these servers have been patched, and for theses one I have a patch ...
- 4 years ago
Something like this?
WeeklyAvgBeforePatch = AVERAGEX ( ADDCOLUMNS ( VALUES ( Alerts[WeekNumber] ), "@BeforeCount", CALCULATE ( COUNTROWS ( Alerts ), Alerts[BeforePatch] = 1 ) ), [@BeforeCount] ) WeeklyAvgAfterPatch = AVERAGEX ( ADDCOLUMNS ( VALUES ( Alerts[WeekNumber] ), "@AfterCount", CALCULATE ( COUNTROWS ( Alerts ), Alerts[BeforePatch] = 0 ) ), [@AfterCount] )
AlexisOlson
Super User
4 years agoSomething like this?
WeeklyAvgBeforePatch =
AVERAGEX (
ADDCOLUMNS (
VALUES ( Alerts[WeekNumber] ),
"@BeforeCount", CALCULATE ( COUNTROWS ( Alerts ), Alerts[BeforePatch] = 1 )
),
[@BeforeCount]
)
WeeklyAvgAfterPatch =
AVERAGEX (
ADDCOLUMNS (
VALUES ( Alerts[WeekNumber] ),
"@AfterCount", CALCULATE ( COUNTROWS ( Alerts ), Alerts[BeforePatch] = 0 )
),
[@AfterCount]
)