
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Highest Sales Store KPI
Hi,
I'm using the below code to try and show the highest sales store in my KPI. Can anyone suggest why it returns a dash instead of a Store Name please?
if(FirstSortedValue([Retailer Name],-Aggr(Sum([Sales Value Gross]),[Retailer Name]))=[Retailer Name],
([Retailer Name]),
null())
I used this code because I successfully got a KPI to show the busiest day using the following code:
if(FirstSortedValue([Day Of Week],-Aggr(Sum([Sales Value Gross]),[Day Of Week]))=6,
subfield(LongDayNames,';',0),
subfield(LongDayNames,';',(FirstSortedValue([Day Of Week],-Aggr(Sum([Sales Value Gross]),[Day Of Week])))+1))
Thanks,
Jen
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it possible to share the sample data? @Jberry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Jberry ,
You'll be able to get the desired output without using the if condition.
Like this,
FirstSortedValue([Retailer Name],-Aggr(Sum([Sales Value Gross]),[Retailer Name]))
If you need to use if condition, then you do as mentioned below,
if(len(FirstSortedValue([Retailer Name],-Aggr(Sum([Sales Value Gross]),[Retailer Name])))>0,
FirstSortedValue([Retailer Name],-Aggr(Sum([Sales Value Gross]),[Retailer Name])),
null())

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank-you for this @Mathumitha - I have applied this expression and it works perfectly!
I am having a similar issue trying to find the store name with the highest wastage (formula below)? I applied the same logic as above only I changed the Sales Value Gross with 'Wastage Cost Value'. The expression appears to be ok in but it isn't giving me the store name:
if(len(FirstSortedValue([Retailer Name],-Aggr(Sum([Wastage Cost Value]),[Retailer Name])))>0,
FirstSortedValue([Retailer Name],-Aggr(Sum([Wastage Cost Value]),[Retailer Name])),
null())
I also tried this formula but it is just the same:
FirstSortedValue([Retailer Name],-Aggr(Sum([Wastage Cost Value]),[Retailer Name]))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it possible to share the sample data? @Jberry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Mathumitha Thank you very much for your help with that! Got sorted!
