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.
Hi all, I need to calculate a monthly average of counting, by category and need to sum the averages as Total. I used a dax script below and it works great except a total. How can I fix it to get a sum of averages in a total row? Thanks in advance, Rita AVG_Count_Per_month =
AVERAGEX (
SUMMARIZE ( Table1, Table1[month-year], Table1[category], "Count", COUNT ( Table1[id] ) ), [Count] )
Hi @Ritaf ,
According to your description, I created some data to show:
Here are the steps you can follow:
1. Create calculcated column.
Month = MONTH('Table'[Date])
Column = CALCULATE(AVERAGE('Table'[amount]),ALLEXCEPT('Table','Table'[Month]))
2. Create Measure.
Measure 2 =
var tt=SUMMARIZE('Table','Table'[Month],"avg_amount",CALCULATE(AVERAGE('Table'[amount])))
return
IF(HASONEVALUE('Table'[Month]),MAX('Table'[Column]),SUMX(tt,[avg_amount]))
3. Result.
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Ritaf , Try if this can work
AVG_Count_Per_month =
var _tab = SUMMARIZE ( Table1, Table1[month-year], Table1[category], "Count", COUNT ( Table1[category] ) )
return
sumx(summarize(_tab,[month-year], "_1", average([Count])),[_1])
unfortunately, it isn't working...
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 |
---|---|
115 | |
99 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |