Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello guys,
I need to help with following group by and average dax formula
my data
y_m | value |
2022_1 | 1 |
2022_1 | 2 |
2022_1 | 3 |
2022_2 | 4 |
2022_2 | 5 |
2022_2 | 6 |
2022_3 | 7 |
2022_3 | 8 |
2022_3 | 9 |
and I would like to get
y_m | value |
2022_1 | 2 |
2022_2 | 5 |
2022_3 | 8 |
I tried to this dax formula
Solved! Go to Solution.
@Petr__ Measures cannot return tables. Your original formula works for me to create a table:
Table 2 = GROUPBY('Table','Table'[y_m],"result",AVERAGEX(CURRENTGROUP(),'Table'[value]))
Also, it works in a measure to create a table var:
Measure =
VAR __Table = GROUPBY('Table','Table'[y_m],"result",AVERAGEX(CURRENTGROUP(),'Table'[value]))
VAR __y_m = MAX('Table'[y_m])
RETURN
MAXX(FILTER(__Table,[y_m] = __y_m),[result])
@Petr__ Just use measure = AVERAGE('Table'[value])
@Petr__ Measures cannot return tables. Your original formula works for me to create a table:
Table 2 = GROUPBY('Table','Table'[y_m],"result",AVERAGEX(CURRENTGROUP(),'Table'[value]))
Also, it works in a measure to create a table var:
Measure =
VAR __Table = GROUPBY('Table','Table'[y_m],"result",AVERAGEX(CURRENTGROUP(),'Table'[value]))
VAR __y_m = MAX('Table'[y_m])
RETURN
MAXX(FILTER(__Table,[y_m] = __y_m),[result])
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
42 | |
21 | |
21 | |
14 | |
14 |
User | Count |
---|---|
43 | |
39 | |
33 | |
18 | |
17 |