EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB9363: What is the difference between the LastInRange() and Last() functions?


Stefan Zepeda

Salesforce Solutions Architect • Strategy


KB9363: What is the difference between the LastInRange() and Last() functions?

Introduction
The Last() function returns the last value of the entire metric. However, the LastInRange() function returns the last value in the range from the first row to the current row in which the LastInRange() function is used. Consider the following examples:
 
Example 1
 
LastInRage() vs. Last()

ka02R000000kbnjQAA_0EM440000002G0K.jpeg

 
The LastInRange() function will pick the last value based on the current row. In the example below, the second row displays $10 as LastInRange() because $10 is the last value among $5 and $10:
 
Example 2

ka02R000000kbnjQAA_0EM440000002G0Q.jpeg

 
This indicates that the LastInRange() function displays the last value in range from the first row to the current row when it is applied. Thus, this is why this function always displays the same value as metric, as illustrated in Example 1, above.
 
However, the Last() function will pick the last value of the entire metric. Therefore, in Example 1, the Last() function displays $30 for all rows.
 
In the following example, the FirstInRange() function is used and the metrics are placed in descending order with $30 on top:
 

ka02R000000kbnjQAA_0EM440000002G0M.jpeg

 
Since $30 is always the first value in the any range of the data, it will always display $30.
 


Comment

0 comments

Details

Knowledge Article

Published:

June 8, 2017

Last Updated:

June 8, 2017