Last updated: 2024-04-29

Source: https://support.freshdesk.com/support/solutions/articles/50000005543-creating-custom-attributes-in-analytics

You can create attributes of your choice and use them in filters or group-by to further organize or drill down your data using Custom Attributes.

Navigation:

  • Go to Analytics tab from your left menu.
  • Click the Settings icon on the top-right corner.
  • Select “Custom Attributes” from the side menu.
  • Creating a custom attribute while creating a new report:You can also create a custom attribute from the chart configuration pane while creating a new report.
  • Click “ Create Attribute” in the top right corner to create custom metrics using a combination of functions or operators.
  • Click “Save Attribute” once done.
  • Use this custom attribute to view the metrics how you would like to create your own Attributes and Group by.
  • You can use the following functions to create your own Attributes and group-by.

    COMMANDMEANING
    Function - Date
    fx DATEDIFF\_SECONDSReturns the difference between X and Y in seconds, X being the later date and Y being the earlier date
    fx DATEDIFF\_MINUTESReturns the difference between X and Y in minutes, X being the later date and Y being the earlier date
    fx DATEDIFF\_HOURSReturns the difference between X and Y in hours, X being the later date and Y being the earlier date
    fx DATEDIFF\_DAYSReturns the difference between X and Y in days, X being the later date and Y being the earlier date
    fx DATEDIFF\_WEEKSReturns the difference between X and Y in weeks, X being the later date and Y being the earlier date
    fx DATEDIFF\_MONTHSReturns the difference between X and Y in months, X being the later date and Y being the earlier date
    fx DATEDIFF\_YEARSReturns the difference between X and Y in years, X being the later date and Y being the earlier date
    fx SECONDReturns X with seconds as the unit
    fx MINUTEReturns X with minutes as the unit
    fx HOURReturns X with hours as the unit
    fx DAYReturns X with days as the unit
    fx MONTHReturns X with months as the unit
    fx YEARReturns X with years as the unit
    Function - Number
    fx CEILReturns the least integer greater than or equal to X<br>Example<br>CEIL (2.5) is 3
    fx FLOORReturns the largest integer lesser than or equal to X<br>Example<br>FLOOR (2.5) is 2
    fx ROUNDRound the number up to the nearest integer value.<br>Example<br>ROUND (2.5) is 3
    fx EXPReturns the value of e (Euler's number) to the power of X<br>Example<br>EXP (2) is 7.38906
    fx GREATESTReturns greatest value among all fields<br>Example<br>GREATEST (1, 2, 3) returns 3
    fx LEASTReturns least value among all fields<br>Example<br>LEAST (1, 2, 3) returns 1
    fx LNReturns the value of the natural logarithm function of X (base e logarithm of X)<br>Example<br>LN (2) is 0.6931471805599453
    fx POWERReturns the value of X to the power of Y<br>Example<br>POWER (2, 3) will return 8
    fx SQRTReturns the value of the square root of X.<br>Example<br>SQRT (4) will return 2
    Function - String
    fx CONCATReturns a string that is basically X1, X2, X3 strung together.<br>Example<br>CONCAT (Down, To, Boogie) will return 'DownToBoogie' as a value
    fx LEFTReturns a string that starts from a number of characters (n) from the beginning of X.<br>Example<br>LEFT (STRING, 1) will return 'TRING'
    fx RIGHTReturns a string that starts from a number of characters (n) from the end of X.<br>Example<br>RIGHT (STRING, 1) will return G
    fx LENGTHReturns the number of characters in X<br>Example<br>LENGTH (STRING) will return 5
    fx LTRIMReturns the string X with leading spaces removed<br>Example<br>LTRIM ( STRING) will return 'STRING'
    fx RTRIMReturns the string X with trailing spaces removed<br>Example<br>RTRIM (STRING ) will return 'STRING'
    fx LPADReturns the string with empty leading space padding on the left, based on the given length.<br>Example<br>LPAD(STRING, 2) will return ' STRING'
    fx RPADReturns the string with empty trailing space padding to the right, based on the given length.<br>Example<br>RPAD (STRING, 2) will return 'STRING '
    fx REPEATReturns the string X repeated n times.<br>Example<br>REPEAT (STRING, 2) will return 'STRINGSTRING'
    fx REVERSEReturns the string X in reverse.<br>Example<br>REVERSE (STRING) will return 'GNIRTS'
    fx SUBSTRINGReturns a substring of X, beginning from position 'n' - counted from left to right.<br>Example<br>SUBSTRING (STRING, 2) will return 'RING'
    fx TRIMReturns X with leading and trailing whitespace removed<br>Example<br>TRIM ( STRING ) will return 'STRING'
    Function - Logical
    fx BETWEENReturns 1 if X is between Y and Z<br>Example<br>BETWEEN (2, 1, 3) will return 1
    fx NOTBETWEENReturns 1 if X is not between Y and Z<br>Example<br>NOTBETWEEN (1, 2, 3) will return 1
    fx ISNULLReturns 1 if X is null, else 0<br>Example<br>ISNULL (CLOSE DATE)
    fx ISNOTNULLReturns 1 if X is not null, else 0<br>Example<br>ISNOTNULL (CLOSE DATE)
    Function - Operators
    +Addition
    -Subtraction
    \*Multiplication
    /Division
    %Modular Division

    Sample metrics for you to get started:

    Defining a custom resolution time which is the time taken from the ‘assigned’ stage to the ‘resolved’ stage. Ticket resolution by the bot is L0 and we do not want to take that into consideration.

    _Formula:_ datediff\_hours(resolved date, created date)