Home » excel » excel – Power BI – DAX equivalent of averageif

excel – Power BI – DAX equivalent of averageif

Posted by: admin May 14, 2020 Leave a comment

Questions:

how can I get DAX version of average if for the following datatable?

Week    NScheduled  Ave per week
1         1          1
1         1          1
1         1          1
1         1          1
2         6          3.5
2         1          3.5
3         4          2.666666667
3         3          2.666666667
3         1          2.666666667

It is simple average for each week?

How to&Answers:

You can use this formula for a calculated column:

Ave per week = CALCULATE(
                   AVERAGE(Table1[NScheduled]);
                   FILTER(Table1; Table1[Week] = EARLIER(Table1[Week]))
               )