Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Not applicable

Add background color for an expression with conditions ??

Hi i am having a pivot table with a 3 expressions sum(metric), avg(upper) and avg(lower), the last two being the benchmarks to be applied to the sum(metric) to apply a background color.

there are also filters Browser,OS and Trip. When any of these filters are applied i dont want the color to change. But on an overall level i want the colors to be like

if(sum(Metric)>= Avg(Uppper),Green(),

                                          if(sum(Metric)<<Avg(Lower),Red())

                                          )

                               )

this works.

But when i  use

if(Browser = Null(),

               if(OS=Null(),

                              if(Trip=Null(),

                                               if(sum(Metric)>= Avg(Uppper),Green(),

                                                              if(sum(Metric)<<Avg(Lower),Red())

                        )

                                              )

                              )

      )

so that the color is applied only when there are no filters applied, it doesnt work. It doesnt show error but no bg color appears.

Please help me out. What is wrong and is there any alternate solution????

1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Re: Add background color for an expression with conditions ??

No selections means everything is selected. What your testing for is if a value in a field is a null value. What you probably want is something like:

if(getselectedcount(Browser) or getselectedcount(OS) or getselectedcount(Trip),

    null(),

    if(sum(Metric)>= Avg(Uppper),

        Green(),

        if(sum(Metric)<Avg(Lower),

            Red()

        )

    )

)


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Highlighted
Luminary
Luminary

Re: Add background color for an expression with conditions ??

Try replacing "Browser = Null()" with "getselectedcount(Browser)=0". Also, you can combine those 3 if statements into 1 using AND. so

if(getselectedcount(Browser)=0 AND getselectedcount(OS)=0 AND etc...

Highlighted
MVP & Luminary
MVP & Luminary

Re: Add background color for an expression with conditions ??

No selections means everything is selected. What your testing for is if a value in a field is a null value. What you probably want is something like:

if(getselectedcount(Browser) or getselectedcount(OS) or getselectedcount(Trip),

    null(),

    if(sum(Metric)>= Avg(Uppper),

        Green(),

        if(sum(Metric)<Avg(Lower),

            Red()

        )

    )

)


talk is cheap, supply exceeds demand

View solution in original post