# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
cancel
Showing results for
Did you mean:
Contributor II

## PYQuarter (Selected month) sales

Following on from my now answered question here: https://community.qlik.com/t5/New-to-Qlik-Sense/PY-selected-month-sales/td-p/1619942

I am now trying to apply similar logic but to get the sales for the Prior Year quarter based on the selected Year and Month

So if selection Year 2018 Month 05 is made it will bring back sales for Year 2017 Quarter 02

I have tried a few different ways of doing this:

sum({<[flag sample] = {0}, distributor_flag = {0}, [month description] = , [month] = {"<=\$(=GetFieldSelections([month]))"}, [quarter code] = {"=\$(=(GetFieldSelections([year]))-1 & 0 & ceil(sum(GetFieldSelections([month])/3)))"}>}[oneforce sales] * [exchange rate]) <--- This one brings back the correct Quarter sales but for the Selected year not the Selected year - 1

Sum({<[flag sample] = {0}, distributor_flag = {0}, [month description] = , [month] = {"<=\$(=GetFieldSelections([month]))"}, [year] = {"\$(=Max(year)-1)"}, [quarter] = {"=\$(='QTR 0' & ceil(sum(GetFieldSelections([month])/3)))"}>}[oneforce sales] * [exchange rate])   <--- This one doesnt seem to work at all and just brings back a "0"

0 Replies