The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.
@Anonymous 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])
@Anonymous Just use measure = AVERAGE('Table'[value])
@Anonymous 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])
User | Count |
---|---|
20 | |
8 | |
7 | |
7 | |
6 |
User | Count |
---|---|
28 | |
13 | |
12 | |
9 | |
8 |