Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi, I need help creating a new measure and have searched but can't find the answer. I'm trying to do a count of the rows and return the average by each group.
For example, given this data set:
Column A | Column B |
Group 1 | Set 1 |
Group 1 | Set 1 |
Group 1 | Set 2 |
Group 2 | Set 3 |
Group 2 | Set 3 |
Group 3 | Set 4 |
Group 1 | Set 5 |
Group 1 | Set 5 |
Group 2 | Set 6 |
I would expect to see this result:
Column A | Avg Count |
Group 1 | 1.666 |
Group 2 | 1.5 |
Group 3 | 1 |
Solved! Go to Solution.
hi @treyd ,
Try to plot a table measure with ColumnA and a measure like:
AvgCount =
VAR _table =
ADDCOLUMNS(
VALUES(data[ColumnB]),
"Count",
CALCULATE(COUNTROWS(data))
)
RETURN
AVERAGEX(_table, [Count])
Hi,
Please check the below picture and the attached pbix file.
Expected result: =
DIVIDE ( COUNTROWS ( Data ), COUNTROWS ( DISTINCT ( Data[Column B] ) ) )
hi @treyd ,
Try to plot a table measure with ColumnA and a measure like:
AvgCount =
VAR _table =
ADDCOLUMNS(
VALUES(data[ColumnB]),
"Count",
CALCULATE(COUNTROWS(data))
)
RETURN
AVERAGEX(_table, [Count])