Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All.
I have a data set where I need to find Max(Sum(Sales)) in a row, so the result should look like below.
I have Sum(Sales) columns calculated and tried to use RangeMax() function to reach Max(Sum(Sales)). But I wasn't successful. Perhaps I used this function incorrectly; maybe there are other ways to achieve the desired result.
Anyway, I will appreciate any advice.
Expected result table:
W1 | W2 | W3 | |||||
Sum(Sales) | Max(Sum(Sales)) | Sum(Sales) | Max(Sum(Sales)) | Sum(Sales) | Max(Sum(Sales)) | ||
Category | Subcategory | ||||||
Category1 | Subcategory1 | 178180.81 | 388468.75 | 331793.4 | 388468.75 | 388468.75 | 388468.8 |
Category1 | Subcategory2 | 117279.04 | 253526.1985 | 253526.1985 | 253526.1985 | 229915.97 | 253526.2 |
Category1 | Subcategory3 | 31162.14 | 31162.14 | 9385 | 31162.14 | 0 | 31162.14 |
maybe
max(aggr(sumSales),Category))
As @robert_mika suggested,
you can aggregate the measure on the required Dimension , in this case the column Dimensions and then put max on them.
Max(aggr(Sum(Sales),Dimension1,Dimension2,...]))
@hi. Thank you for the advice. I tried this way of aggregation, and this gives me no result. Probably something is special about the data itself. So I continue to investigate this question.
Try this
Max(
Aggr(
Sum(Sales),
Category,
Subcategory,
Week
)
)
Or may be
RangeMax(
Sum({<Week={'W1'}>} Sales),
Sum({<Week={'W2'}>} Sales),
Sum({<Week={'W3'}>} Sales
)
)