Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression formula based on dimension

Hello,

I have one problem to show data in the pivot table according to the dimension.

Amount:

load *Inline

[account, amount, Year Month

acc_1, 100, 201306

acc_2, 200, 201306

acc_3, 300, 201306

acc_4, 400, 201206

acc_5, 500, 201206

acc_6, 600, 201206];

If use the expressions for the current and previous years, the expression works properly.

TY : sum({<[Year Month] = {'201306'}>}amount)

PY : sum({<[Year Month] = {'201306'}>}amount)

img1.png

But when I want to show the data with dimension (Actual, Last Year), the expression doesn't working for Last year

if(D1_no = 10, //Current Year

          sum({<[Year Month] = {'201306'}>}amount),

          if(D1_no = 30, //Last Year

                    sum({<[Year Month] = {'201206'}>}amount)

          )

)

img2.png

3 Replies
Not applicable
Author

It works fine, if I will add NULL values for the missed periods for the accounts:

Concatenate(Amount)

load * Inline

[account, Year Month

acc_4, 201306

acc_5, 201306

acc_6, 201306

];

But I'm not sure that it's right way

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Remove the selection of YearMonth field.

Regards,

Kaushik Solanki    

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Problem that period should be selected