Forum Discussion
jacinto
4 years agoFrequent Visitor
Filter table by current row value then take either average or current value
I spent quite a lot on this but still I am struggling. Here is what I want to achieve, I am happy with either measure or column that gives me accurate result. Filter List table by current Item then i...
- 4 years ago
jacinto , Try a new measure like
var _1 = calculate( Average(Table[Value]), filter( allselected(Table) , Table[Item] = max(Table[Item])))
var _2 = calculate( Average(Table[Value]), filter( allselected(Table) , Table[Item] = max(Table[Item]) && Table[CountryS] = "GLO" ))
return
if(isblank(_2), _1, _2)
johnt75
4 years agoSuper User
If you know that there is at most one value of GLO for each item then you can try
avg =
var GLOValue = CALCULATETABLE(SELECTCOLUMNS( 'List', "@val", 'List'[Value]),
ALLEXCEPT('List', 'List'[Item])
)
return IF( NOT( ISBLANK( GLOValue)), GLOValue,
CALCULATE( AVERAGE('List'[Value]), ALLEXCEPT('List'[Item]))
)