Forum Discussion
POSPOS
Post Partisan
2 years agoIncorrect Mean and Median Values using DAX
Hi, I have a requirement to calculate mean and median between the two dates. Please find sample data below: Protocol Submit Date Intake Date New calcualted column for datediff 190 04/...
- 2 years ago
I think you should be a bit careful with that table visual. It doesn't have any aggregations so in a way it's a kind of false table because the 190 row actually represents 2 rows which no-one would know unless they looked at the whole data.
Because of this 'false' table it will take a measure like this to get the average you want
MeasureX = var _summTab = SUMMARIZECOLUMNS('data1111 (2)'[Protocol Number], 'data1111 (2)'[Intake Date], data1111[First_SubmitDate], "MinDiff", MIN(data1111[Datediff])) var _RowCount = COUNTROWS(_summTab) var _SumTotal = SUMX(_summTab, [MinDiff]) RETURN DIVIDE(_SumTotal, _RowCount)
HotChilli
Community Champion
2 years agoI think you should be a bit careful with that table visual. It doesn't have any aggregations so in a way it's a kind of false table because the 190 row actually represents 2 rows which no-one would know unless they looked at the whole data.
Because of this 'false' table it will take a measure like this to get the average you want
MeasureX = var _summTab = SUMMARIZECOLUMNS('data1111 (2)'[Protocol Number], 'data1111 (2)'[Intake Date], data1111[First_SubmitDate], "MinDiff", MIN(data1111[Datediff]))
var _RowCount = COUNTROWS(_summTab)
var _SumTotal = SUMX(_summTab, [MinDiff])
RETURN
DIVIDE(_SumTotal, _RowCount)