Skip to main content

HI, as a newbie to PQL, I am would need help in order to calculate the different in stock levels between two months. The current display shows the SUM of the stock, with a Component Filter the particular month. How could I calculate the difference between the starting stock (January) and the current stock level, by month? (there are multiple stock items)

Thanks

Kenny7

Hi Kenneth,

Depends whether the date and the stock are on the same table.

 

Syntax should look like the following if they exist in the same table:

 

SUM(

CASE WHEN MONTH(TABLE.MONTH) = MONTH(TODAY()) THEN TABLE.STOCK ELSE 0.0 END

)

-

SUM(

CASE WHEN MONTH(TABLE.MONTH) = 1 THEN TABLE.STOCK ELSE 0.0 END

)

 


Reply