Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
vvira1316
Specialist II
Specialist II

Conditional Visual Cue in Pivot table based on only one value of a particular dim

Hi,

Following table is a Pivot Table in QV App. I've a situation where only Variance row of [Actual / Budget] dimension needs to be represented in Red/Green font based on >0 or <0. I've written statement and tried using it in visual cue (Upper, Normal, Lower, Text) but it keeps all rows in black. I've tested my condition on individual values and it is working as I want for value related to KPI, Actual/Budget/Variance, Month, Year, etc.

Thanking you in advance. Any guidance will be helpful.

   

KPI JulAugSepOctNovDecJanFebMarAprMayJun
I/PActual 4,1634,0023,87114,8725,1185,7385,5545,4346,3346,2435,941
I/PBudget 4,0584,0583,9124,1563,9123,9124,2054,0104,2534,1564,2533,999
I/PVariance105(56)(41)10,7161,2061,8261,3491,4242,0812,0871,688
O/PActual 557608575712673553589559792788705
O/PBudget 435416416435376406396396445416416433
O/PVariance122192159277297147193163347372289
SuppliesActual 14,41215,41614,01412,86711,26818,68410,75115,63716,64914,34614,184
SuppliesBudget 12,47212,42312,05012,72211,94812,02512,74712,24912,99512,67312,92112,316
SuppliesVariance(1,940)(2,993)(1,964)(145)680(6,659)1,996(3,387)(3,654)(1,672)(1,263)
SWBActual 263,708285,522347,151288,269287,322278,991342,103287,523291,711300,658281,229
SWBBudget 298,880298,921289,240298,920289,194298,772298,836279,600298,922289,275298,869289,279
SWBVariance35,17213,399(57,910)10,6511,87219,781(43,267)(7,923)7,211(11,383)17,640

=If(
[ACTUAL / BUDGET] = 'Variance'

,

If(
(
If(((FLAG = 'Supplies' or FLAG = 'SWB') and [ACTUAL / BUDGET] = 'Variance'),
-1 *
If(FLAG='I/P',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'I/P'}, [RPT SECTION]={'*Stat*'}>}VALUE),
If(FLAG='O/P',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'O/P'}, [RPT SECTION]={'*Stat*'}>}VALUE),
If(FLAG='SWB',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'SWB'}>}VALUE),
If(FLAG='Supplies',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'Supplies'}>}VALUE))))),
If(FLAG='I/P',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'I/P'}, [RPT SECTION]={'*Stat*'}>}VALUE),
If(FLAG='O/P',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'O/P'}, [RPT SECTION]={'*Stat*'}>}VALUE),
If(FLAG='SWB',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'SWB'}>}VALUE),
If(FLAG='Supplies',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'Supplies'}>}VALUE))))))
) > 0 ,
RGB(0,170,0),
If(
(
If(((FLAG = 'Supplies' or FLAG = 'SWB') and [ACTUAL / BUDGET] = 'Variance'),
-1 *
If(FLAG='I/P',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'I/P'}, [RPT SECTION]={'*Stat*'}>}VALUE),
If(FLAG='O/P',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'O/P'}, [RPT SECTION]={'*Stat*'}>}VALUE),
If(FLAG='SWB',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'SWB'}>}VALUE),
If(FLAG='Supplies',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'Supplies'}>}VALUE))))),
If(FLAG='I/P',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'I/P'}, [RPT SECTION]={'*Stat*'}>}VALUE),
If(FLAG='O/P',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'O/P'}, [RPT SECTION]={'*Stat*'}>}VALUE),
If(FLAG='SWB',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'SWB'}>}VALUE),
If(FLAG='Supplies',
Sum({$<Entity={"$(vEntitySelected)"}, DEPARTMENT={"$(vDepartmentSelected)"}, FLAG={'Supplies'}>}VALUE))))))
) < 0 ,
RGB(170,0,0),RGB(0,0,0)))
,
RGB(0,0,0))

1 Solution

Accepted Solutions
NickHoff
Specialist
Specialist

instead of using visual cues if you just want to color the text add logic to your text color on the dimension or expression you wish to change.  If your conditional logic is working correctly just add it there.

textcolor logic.png

View solution in original post

5 Replies
NickHoff
Specialist
Specialist

instead of using visual cues if you just want to color the text add logic to your text color on the dimension or expression you wish to change.  If your conditional logic is working correctly just add it there.

textcolor logic.png

vvira1316
Specialist II
Specialist II
Author

Hi Nick,

Yes, That works. Thanks for suggestion. One quick question on same. Is it possible to do Bold for variance using Text Format? If so, what is the syntax for it?

vvira1316
Specialist II
Specialist II
Author

Nick,

I found the answer.

=If(
[ACTUAL / BUDGET] = 'Variance','<B>')

NickHoff
Specialist
Specialist

<'B'> is the syntax however, I'm not sure if it works in the table, but you can always do custom formatting on the text to make it bold.  This example shows where to do the custom format, if the option isn't available you'll have to enable it under your User Preferences > Design > Always Show Design Menu Items (checked)

custom format.png

vvira1316
Specialist II
Specialist II
Author

Thanks again for sharing an alternative. The '<B>' formatting worked just fine. I've included screen shot of output.PivotTable_Formatted.JPG