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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Color Change

Hi All,

I want the color of Profit\Loss to be changed to Red(Negative Values) and Green(Positive Values) for DTD, MTD and YTD.

It should be changed only in Profit\Loss.

PFA Qvw.

Please help me with this ASAP.

Thanks & Regards,

Keerthi

Labels (1)
2 Replies
Not applicable
Author

HI All,

I got the solution.

I have used the below expression in Background Text

if(CATEGORY='Profit\Loss',

if([Time Dimension]='DTD',

if(sum({$<TradeDate={'3/28/2014'}>}SalePrice)-sum({$<TradeDate={'3/28/2014'}>}TradePrice)>0,Green(),red()),

if([Time Dimension]='MTD',

if(SUM({<Year={'$(vMaxYear)'},Month={'$(vMaxMonth)'},Day={'<=$(vMaxDay)'},TradeDate=>}SalePrice)-SUM({<Year={'$(vMaxYear)'},Month={'$(vMaxMonth)'},Day={'<=$(vMaxDay)'},TradeDate=>}TradePrice)

>0,Green(),red()),

if([Time Dimension]='YTD',

if(SUM({<Year={'$(vMaxYear)'},TradeDate={'<=$(vMaxDate)'},Month=,Day=>}SalePrice)-SUM({<Year={'$(vMaxYear)'},TradeDate={'<=$(vMaxDate)'},Month=,Day=>}TradePrice)>0,Green(),red()),

)

)

)

)

Thanks & Regards,

Keerthi

its_anandrjs
Champion III
Champion III

I suggest use variables for this like

vDTD = if(sum({$<TradeDate={'3/28/2014'}>}SalePrice)-sum({$<TradeDate={'3/28/2014'}>}TradePrice)

vMTD = if(SUM({<Year={'$(vMaxYear)'},Month={'$(vMaxMonth)'},Day={'<=$(vMaxDay)'},TradeDate=>}SalePrice)-SUM({<Year={'$(vMaxYear)'},Month={'$(vMaxMonth)'},Day={'<=$(vMaxDay)'},TradeDate=>}TradePrice)


vYTD = if(SUM({<Year={'$(vMaxYear)'},TradeDate={'<=$(vMaxDate)'},Month=,Day=>}SalePrice)-SUM({<Year={'$(vMaxYear)'},TradeDate={'<=$(vMaxDate)'},Month=,Day=>}TradePrice)


And then use your expression like


if(CATEGORY='Profit\Loss',

if([Time Dimension]='DTD',

$(vDTD)>0,Green(),red()),

if([Time Dimension]='MTD',

$(vMTD)>0,Green(),red()),

if([Time Dimension]='YTD',

$(vYTD)>0,Green(),red()),

))))

Hope this helps