Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
mhapanka
Creator
Creator

Color by Background/ text Color expression

Hi,

I have a pivot table in which I calculated the measure using expression :

=Sum(NetSalesAmtUSD)/Before(Sum({<[Fiscal Year]>}NetSalesAmtUSD))-1

to get the growth rate. I want to color the text Red if below 20%, Amber if between 20%-60% and Green if above 60%.

But since this measure is not a column, I am unable to change the color of it using the regular color by expression function.

How can I achieve this?

I created a master item but of the above formula and called it % change in Sales but unable to get the right code.

1 Solution

Accepted Solutions
Neymar_Jr
Creator II
Creator II

Hi,

Try as below -

If(

((Sum(NetSalesAmtUSD)/Before(Sum({<[Fiscal Year]>}NetSalesAmtUSD)))-1) < 0.2, rgb(229,122,122),

  If(((Sum(NetSalesAmtUSD)/Before(Sum({<[Fiscal Year]>}NetSalesAmtUSD)))-1) > 0.2 and

    ((Sum(NetSalesAmtUSD)/Before(Sum({<[Fiscal Year]>}NetSalesAmtUSD)))-1) > .6, rgb(229,100,100), green()

    )

    )

Thanks,

RT

View solution in original post

4 Replies
Neymar_Jr
Creator II
Creator II

Hi,

There is background and text color expression option available in measure of pivot chart. I guess, you can use if condition there.

Thanks,

RT

ChennaiahNallani
Creator III
Creator III

write your condition below options.

Capture.PNG

balabhaskarqlik

May be your expression like this:

=Sum(NetSalesAmtUSD)/Before(Sum({<[Fiscal Year]>}NetSalesAmtUSD))

And for Text Color change:

=If((Sum(NetSalesAmtUSD)/Before(Sum({<[Fiscal Year]>}NetSalesAmtUSD))) < 20%, rgb(229,122,122),

  If((Sum(NetSalesAmtUSD)/Before(Sum({<[Fiscal Year]>}NetSalesAmtUSD))) > 20% and

     (Sum(NetSalesAmtUSD)/Before(Sum({<[Fiscal Year]>}NetSalesAmtUSD))) > 60%, rgb(229,100,100), green())

Neymar_Jr
Creator II
Creator II

Hi,

Try as below -

If(

((Sum(NetSalesAmtUSD)/Before(Sum({<[Fiscal Year]>}NetSalesAmtUSD)))-1) < 0.2, rgb(229,122,122),

  If(((Sum(NetSalesAmtUSD)/Before(Sum({<[Fiscal Year]>}NetSalesAmtUSD)))-1) > 0.2 and

    ((Sum(NetSalesAmtUSD)/Before(Sum({<[Fiscal Year]>}NetSalesAmtUSD)))-1) > .6, rgb(229,100,100), green()

    )

    )

Thanks,

RT