Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
laura_1
Partner - Contributor III
Partner - Contributor III

PY Calculation when Year filter is selected

Hi, 

Is there a way to calculate PY values when a value is selected in year filter? 

Let's assume we have the following values:

Year, Sales

2019, 50

2018, 40

2017, 20

If I select 2019 in the year filter, sum ({<Year={"$(=max(Year))"}>} sales) returns current year (2019) values, but calculation for PY sum ({<Year={"$(=max(Year))-1"}>} sales) returns zero.

1 Solution

Accepted Solutions
dplr-rn
Partner - Master III
Partner - Master III

thats odd. 

i checked below in my local app and it works.

sum ({<Year={"$(=max(Year)-1)"}>} LineSalesAmount)

which version of sense are you on.  newer versions give an output preview of the dollar sign expansion. see below. check that

Capture.PNG

Capture.PNG

View solution in original post

5 Replies
dplr-rn
Partner - Master III
Partner - Master III

your -1 is not inside the dollar sign expansion

sum ({<Year={"$(=max(Year))-1"}>} sales) 

change to below

sum ({<Year={"$(=max(Year)-1)"}>} sales) 

laura_1
Partner - Contributor III
Partner - Contributor III
Author

Thanks for your quick reply but it still returns zero..

dplr-rn
Partner - Master III
Partner - Master III

thats odd. 

i checked below in my local app and it works.

sum ({<Year={"$(=max(Year)-1)"}>} LineSalesAmount)

which version of sense are you on.  newer versions give an output preview of the dollar sign expansion. see below. check that

Capture.PNG

Capture.PNG

laura_1
Partner - Contributor III
Partner - Contributor III
Author

Checked again and it worked, thanks very much for your help 🙂 

dplr-rn
Partner - Master III
Partner - Master III

Great. Mark as answered to close the thread