Skip to main content
Question

PQL substraction (a-b)

  • November 14, 2019
  • 5 replies
  • 11 views

Hi, Im trying to calcul the difference between to column in the same OLAP table. I used this formula : {TMP_CDHDR_CDPOS.VALUE_OLD}-{TMP_CDHDR_CDPOS.VALUE_NEW} but the system alway run he never give me a results why ?

5 replies

joos.buijs
Level 10
Forum|alt.badge.img+2
  • Level 10
  • November 15, 2019
If its not giving an error it might just take a wile? Might help to aggregate or at least filter the output/component. Im also wondering about the { and } notation, fur us (CPM 4.5 on premise) we need to use around table and column names.

Audrey: TMP_CDHDR_CDPOS.VALUE_OLD}-{TMP_CDHDR_CDPOS.VALUE_NEW Hi, when im using the title of the column without the { and } I receive an error. image904131 9.35 KB Thanks for the help.

You need to use the STR_TO_INT() function to convert the values to Integers rather than String values. You cannot do mathematical calculations on strings.

When I put this formule, ive no result, the column become empty. Why ? STR_TO_INT(TMP_CDHDR_CDPOS.VALUE_OLD).

Hi Audrey, the STR_TO_INT function returns null, if the input is not a number. My solution for that would also to cast the numbers which are loaded as strings with the STR_TO_INT function so that they can substracted. Best, Viana