Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Show amount for max day in a month

Hi all,

I have the following dataset, and in a straight table I'm trying to list out the month (as dimension) and the amount corresponding to the max day of each month as the expression.

LOAD * INLINE [

    Month, Day, Amt

    1, 1, 5

    1, 2, 6

    1, 3, 2

    2, 5, 8

    2, 6, 9

    2, 7, 4

    3, 8, 11

    3, 9, 3

    3, 10, 2];

So for month 1, the Amt value would be 2 (corresponds to day 3, which is the max day of month 1), for month 2 the Amt value would be 4, for month 3 the Amt value would be 2.  If I'm using Month as dimension, what would I use for the expression to show the correct amount for each month?  I suspect I should use set analysis and AGGR and the Only() function, but I haven't been able to figure out the right combination.

Thanks very much!

Robin

1 Reply
SergeyMak
Partner Ambassador
Partner Ambassador

Hi

Try this

FirstSortedValue(Amt,-Day)

Regards,
Sergey