Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Peony
Creator III
Creator III

How to calculate Max value in a row?

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))
CategorySubcategory      
Category1Subcategory1178180.81388468.75331793.4388468.75388468.75388468.8
Category1Subcategory2117279.04253526.1985253526.1985253526.1985229915.97253526.2
Category1Subcategory331162.1431162.14938531162.14031162.14
Labels (1)
5 Replies
robert_mika
Master III
Master III

maybe

max(aggr(sumSales),Category))

Gabbar
Specialist
Specialist

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,...]))

Peony
Creator III
Creator III
Author

@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. 

Sivapriya_d
Creator
Creator

Hi @Peony 
are you tying something like this ?

Sivapriya_d_0-1758359673644.png

 

Chanty4u
MVP
MVP

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

)

)