Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
infock12
Creator III
Creator III

pivot table - getting expressions horizantal instead of vertical

Hi all,

Hope you are all well. I am trying to do a pivot table. Dimensions are: Dept Code, Result, Target and Month. The expression is sum(OrderActual).

I can pivot things but the result I am trying to get is attached in the excel spreadsheet (End Result) and also pasted below.

I tried to add calculated dimension with the formula =sum({<Result={'AB'}>}OrderActual)/sum({<Result={'OPSRIC'}>}OrderActual), I get an error message.


As you can see below, I am trying to get AB, OPSPRIC, OPRate (which will be the result of the above expression), Target, and Variance TO Target (which would be 'Target-OPRate') - ALL HORIZANTALY just like below. In Background colour, I would like to say, IF(Target-OPRate)>0, Red, Green). Any help is appreciated.

    

Dept CodeResultMonthAt Month 6
123456
AC23ZAB20140310
OPSRIC5976417306776776954017
OPRate0.000.000.000.010.000.000.00
Target0.050.050.050.050.050.050.05
variance to Target-0.047-0.050-0.049-0.044-0.050-0.046-0.048
KC15SAB406871627248361
OPSRIC1481951941621992181116
OPRate0.270.350.370.380.360.220.32
Target0.050.050.050.050.050.050.05
variance to Target0.2200.2990.3160.3330.3120.1700.273

Thanks,

Karthik

1 Solution

Accepted Solutions
sunny_talwar

This?

Capture.PNG

Background color expression

If(Dim = 4,

  If(Sum({<Result={'AB'}>}OrderActual)/sum({<Result={'OPSRIC'}>}OrderActual) > Target, Green(), Red()))

View solution in original post

8 Replies
sunny_talwar

Is this what you want?

Capture.PNG

infock12
Creator III
Creator III
Author

Hi Sunil,

exactly what what I wanted. I will look at it when I reach home. Thank you very much. I don't have Qlikview server access. I will give it a go and let you know.

sunny_talwar

Sounds like a plan. Btw my name is Sunny (not Sunil) my friend

infock12
Creator III
Creator III
Author

‌oops, sorry Sunny! I think it was the auto text! 

sunny_talwar

no problem

infock12
Creator III
Creator III
Author

Hi Sunny,

Thanks again for the response and it is working great! However, I tried to colour code the 'Variance to Target' row. In principle, if Target > OPRare, it should be red, otherwise green. I tried various combinations that you have used under 'Expressions' but I am doing something wrong. The closest I could get to (still not correct) is with the below, but it highlights the OPRare and the Target field rather than the 'Variance to Target' field. Clearly, I am doing something wrong. Please could you point me in the right direction.

=PICK(Dim, Num(Sum({<POD={'DC'}>}ActivityActual)/sum({<POD={'OPPROC'}>}ActivityActual), '##.00')>Target, Green(), Red())

Thanks,

Karthik

sunny_talwar

This?

Capture.PNG

Background color expression

If(Dim = 4,

  If(Sum({<Result={'AB'}>}OrderActual)/sum({<Result={'OPSRIC'}>}OrderActual) > Target, Green(), Red()))

infock12
Creator III
Creator III
Author

That is it!! Thank you very much Sunny, extremely helpful.