Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
arjunmadhusudan
Contributor III
Contributor III

find highest sales for each month in a time series bar chart

I have the following data:

   

CompanyMonth YearSales
aJan-1710
aFeb-1720
aMar-1711
aApr-1713
bJan-1740
bFeb-1745
bMar-172
bApr-174
cJan-1755
cFeb-173
cMar-1740
cApr-171

I need a times series bar chart which has X axis = Month Year and  Y axis  =  Highest sale for that time period group by company

For example for Jan-17 I should get sale  = 55 which for company c.

12 Replies
tresesco
MVP
MVP

Like this:

Dual( FirstSortedValue(Company, -Aggr(Sum(Sales), [Month Year], Company))& ' : '& Max(Sales), Max(Sales))

Capture.JPG

arjunmadhusudan
Contributor III
Contributor III
Author

I need also have an exclude filter for company.  Company selected in the filter should not be part of calculation.

How can we do this ?

thevingo
Creator
Creator

bypass company in SET analysis

or

Use TOTAL keyword at company-level

tresesco
MVP
MVP

You may try with:

Dual(FirstSortedValue({<Company=e(Company)>}Company, -Aggr(Sum({<Company=e(Company)>}Sales), [Month Year], Company))& ' : '& Max({<Company=e(Company)>}Sales), Max({<Company=e(Company)>}Sales))

With this, when noting is selected from exclude filter, all companies would be excluded, hence the chart would go blank. If you want to put a condition like when at least one value from the exclude filter is selected then only the exclusion should work, you might try with additional conditional check like: If(GetSelectedCount(Company)>0, ....

arjunmadhusudan
Contributor III
Contributor III
Author

Shows the highest from the whole list.

tresesco
MVP
MVP

Try like:

If( GetSelectedCount(Company)>0,

Dual(FirstSortedValue({<Company=e(Company)>}Company, -Aggr(Sum({<Company=e(Company)>}Sales), [Month Year], Company))& ' : '& Max({<Company=e(Company)>}Sales), Max({<Company=e(Company)>}Sales)),

Dual(FirstSortedValue(Company, -Aggr(Sum(Sales), [Month Year], Company))& ' : '& Max(Sales), Max(Sales))

)

arjunmadhusudan
Contributor III
Contributor III
Author

Results not matching with table value. There seems to be an issue with the expression logic.

sunny_talwar

Results not matching with table value.

Which table are you talking about? Can you elaborate with an example as to why you think tresesco‌'s expression isn't working?

arjunmadhusudan
Contributor III
Contributor III
Author

I checked with my data this seems to give me wrong values for sales.