Forum Discussion

AkrMus's avatar
AkrMus
Icon for Helper I rankHelper I
7 years ago
Solved

Average with Group by DAX

Hi

I have this data

 

myRate | myDate

7           | 1 Feb 2019

3           | 14 Feb 2019

9           | 1 Feb 2019

4           | 4 Mar 2019

6           | 11 Apr 2019

3           | 13 Mar 2019

8           | 9 Feb 2019

2           | 2 Apr 2019

6           | 1 Feb 2019

5           | 2 Apr 2019

1           | 21 Feb 2019

9           | 18 Mar 2019

3           | 30 Mar 2019

 

 How in DAX I can get a new column that Shows this

 

New_Column = Average of Rates to the same months

 

my Daya will ook like this

 

myRate | myDate           | myAvg

7           | 1 Feb 2019      | 5.66

3           | 14 Feb 2019    | 5.66

9           | 1 Feb 2019      | 5.66

4           | 4 Mar 2019      | 4.75

6           | 11 Apr 2019    | 4.33

3           | 13 Mar 2019   | 4.75

8           | 9 Feb 2019      | 5.66

2           | 2 Apr 2019      | 4.33

6           | 1 Feb 2019      | 5.66

5           | 2 Apr 2019      | 4.33

1           | 21 Feb 2019    | 5.66

9           | 18 Mar 2019   | 4.75

3           | 30 Mar 2019   | 4.75

 

 

  • hi, AkrMus 

    If you want it could be filtered by myRate , just try this formula

    Measure = calculate(average( 'Table'[myRate]), FILTER(ALLSELECTED('Table'),'Table'[Month]=MAX('Table'[Month])))

    Result:

     

    Best Regards,

    Lin

     

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Create a new column and put your column titles in the appropriate spots i have put in bold

     

    Average = calculate(average( my rate column), ALLEXCEPT(table name, my date column)