Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I have a data set that has values and the year that value was recorded. I want to create a measure that will display the maximum value for that year when I add it to a table. For example, my data looks like this:
Year | Value |
2008 | 1 |
2008 | 3 |
2008 | 1 |
2009 | 4 |
2010 | 3 |
2010 | 5 |
2010 | 1 |
2011 | 3 |
2011 | 2 |
2012 | 1 |
So the measure I want would add a column to the table that looks like this:
Year | Value | Max |
2008 | 1 | 3 |
2008 | 3 | 3 |
2008 | 1 | 3 |
2009 | 4 | 4 |
2010 | 3 | 5 |
2010 | 5 | 5 |
2010 | 1 | 5 |
2011 | 3 | 3 |
2011 | 2 | 3 |
2012 | 1 | 1 |
I tried:
Solved! Go to Solution.
@Anonymous ,
try like
Measure = CALCULATE(MAX('Table'[Value]),allexcept('Table'[Year]))
You can also try
@Anonymous ,
try like
Measure = CALCULATE(MAX('Table'[Value]),allexcept('Table'[Year]))
Thank you, that works.
What if I want the average for each year?
Year | Value | Average |
2008 | 1 | 1.66 |
2008 | 3 | 1.66 |
2008 | 1 | 1.66 |
2009 | 4 | 4 |
2010 | 3 | 3 |
2010 | 5 | 3 |
2010 | 1 | 3 |
2011 | 3 | 2.5 |
2011 | 2 | 2.5 |
2012 | 1 | 1 |
HI @Anonymous,
You can try below measure formula if it works:
Measure =
CALCULATE (
AVERAGE ( table[Value] ),
ALLSELECTED ( table ),
VALUES ( table[Year] )
)
You can change the aggregate functions to apply different summary mode on your fields. (min, max, sum, average...)
Regards,
Xiaoxin Sheng
User | Count |
---|---|
102 | |
88 | |
78 | |
71 | |
69 |
User | Count |
---|---|
113 | |
99 | |
97 | |
72 | |
68 |