Forum Discussion
Erik_Debono
6 years agoAdvocate II
Dax Average with Distinct Filter
Hi All, I'm trying to filter a table (have provided a mock one below) where I filter by Distinct and a result. As you can see, the Cycle time will be the same for every ID but I only want to Aver...
- Anonymous6 years ago
Hi Erik_Debono -
Try the following:
Cycle Time Average = var _table = DISTINCT( SELECTCOLUMNS( FILTER('Cycle Time', [Result]<>"N/A"), "ID", [ID], "CycleTime", [CycleTime] ) ) return AVERAGEX(_table, [CycleTime])
Anonymous
6 years agoNot applicable
Hi Erik_Debono -
Try the following:
Cycle Time Average =
var _table = DISTINCT(
SELECTCOLUMNS(
FILTER('Cycle Time', [Result]<>"N/A"),
"ID", [ID],
"CycleTime", [CycleTime]
)
)
return AVERAGEX(_table, [CycleTime])
Erik_Debono
6 years agoAdvocate II
Hi Anonymous
Thank you for that. I tried your formula and i'm getting underline errors for the following:
- Name 2 [ID] on line 5
- Name 3 [CycleTime] on line 6 and
- Expression [CycleTime] on the last line.
The overall error is "Function SELECTCOLUMNS expects a column name as argument number 4"
- Nathaniel_C6 years agoCommunity Champion
Hi Erik_Debono , Anonymous ,
I built a table using copy and paste from your numbers, and it works for me.
Nathaniel