Forum Discussion
Max Value for 2 Filters
Hi there,
I have a question. I have the following dataset:
| ID | Code | OpportunityID | Modified | YearMonth | StageID |
| 142 | SF000020 | 20 | 4/10/19 | 2019/04 | 5 |
| 106 | SF000020 | 20 | 4/4/19 | 2019/04 | 4 |
| 105 | SF000020 | 20 | 4/4/19 | 2019/04 | 4 |
| 99 | SF000020 | 20 | 3/29/19 | 2019/03 | 4 |
| 98 | SF000020 | 20 | 3/29/19 | 2019/03 | 3 |
| 87 | SF000020 | 20 | 3/25/19 | 2019/03 | 2 |
| 86 | SF000020 | 20 | 3/25/19 | 2019/03 | 2 |
| 85 | SF000020 | 20 | 3/25/19 | 2019/03 | 1 |
I want to know in a calculated column: the highest StageID per Code per month. In this example, the Code is filtered on 'SF00020', but in my dataset there are much more Codes.
So the solution should provide me for April StageID 5 and for March StageID 4.
I tried a few calculate(max(filter-options, but I couldn't solve the problem.
Cheers,
Johan
Hi,
Try this calculated column formula
=CALCULATE(MAX(Data[StageID]),FILTER(Data,Data[Code]=EARLIER(Data[Code])&&Data[YearMonth]=EARLIER(Data[YearMonth])))
Hope this helps.
2 Replies
- parry2kSuper User
johanthedataman add new measure using following expression
Max Stage = CALCULATE( MAX( Table4[StageID] ), ALLEXCEPT( Table4, Table4[Code], Table4[YearMonth] ) )
- Ashish_MathurSuper User
Hi,
Try this calculated column formula
=CALCULATE(MAX(Data[StageID]),FILTER(Data,Data[Code]=EARLIER(Data[Code])&&Data[YearMonth]=EARLIER(Data[YearMonth])))
Hope this helps.