Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
joeybird
Creator III
Creator III

Trend Line only appears when filter selected

Hiya

I have a line charts showing total number of sales per month

when I select from a filter pane - Department - Catering...

the line changes to the total number of sales for that department, which is correct...

however.

I want the line charts showing total number of sales per month

and an additional line for  the total number of sales for that department

I can do this expression, but the line is only to appear if a department is selected.

any ideas on show / hide function?

please help

15 Replies
joeybird
Creator III
Creator III
Author

Hiya

I have this working, but it wont show the 3rd line

when required

please help

JonnyPoole
Employee
Employee

what is the current expression condition ?  paste it in your reply

joeybird
Creator III
Creator III
Author

if( Valuelist('SaleTotal','DeptTotal') = 'SaleTotal', sum({$<[Department] =>} Sales),

     if( Valuelist('SaleTotal','DeptTotal') = 'DeptTotal',

          if( getselectedcount([Department]) = 'Catering'  ,  sum({$<[Department] ="Catering">} Sales),

          if( getselectedcount([Department]) = 'HomeWare'  ,  sum({$<[Department] ="HomeWare">} Sales) )
         
          

     )

)

please help

reddy-s
Master II
Master II

Hi Joanna,

The expression which you have used is wrong, instead try this:

if( Valuelist('SaleTotal','DeptTotal') = 'SaleTotal', sum({$<[Department] =>} Sales),

     if( Valuelist('SaleTotal','DeptTotal') = 'DeptTotal',

          if( Valuelist( GetFieldSelections([Department]) ) = 'Catering'  ,  sum({$<[Department] ="Catering">} Sales),

          if( Valuelist( GetFieldSelections([Department]) ) = 'HomeWare'  ,  sum({$<[Department] ="HomeWare">} Sales) )
         
         

     )

)

joeybird
Creator III
Creator III
Author

Hiya

this sort of works, but I still cant get the third line to appear when the second department is selected

but I did amend

if( Valuelist('SaleTotal','DeptCatTotal', 'DeptHomewTotal')= 'SaleTotal', sum({$<[Department] =>} Sales),

     if( Valuelist('SaleTotal','DeptCatTotal', 'DeptHomewTotal') = 'DeptTotal',

          if( Valuelist( GetFieldSelections([Department]) ) = 'Catering'  ,  sum({$<[Department] ="Catering">} Sales),

          if( Valuelist( GetFieldSelections([Department]) ) = 'HomeWare'  ,  sum({$<[Department] ="HomeWare">} Sales) )
         
         

     )

)

I have tried to create a value list of

Valuelist('SaleTotal','DeptCatTotal', 'DeptHomewTotal')

a third line in the key has now appeared ,

it still does not work

please help

JonnyPoole
Employee
Employee

I think i understand. Below instead of department i am doing this on countries_world.Name.

The way the logic goes is:

if a country is selected, than show 3 lines for each valuelist element. The selected sales per month "sum(Sales)", the total selected sales for all months "sum ( total Sales)" , and the application total for all  months and all countries "sum( {<countries_world.Name=>} total Sales)".

if no country is selected, then just show the monthly sales for the current selections.

if( GetSelectedCount(countries_world.Name)>0,

  if( ValueList('MonthlySelectedSales','TotalSelectedSales','TotalSales')= 'TotalSelectedSales', sum ( total Sales),

   

    if( ValueList('MonthlySelectedSales','TotalSelectedSales','TotalSales')= 'TotalSales', sum( {<countries_world.Name=>} total Sales),

       

        if( ValueList('MonthlySelectedSales','TotalSelectedSales','TotalSales')='MonthlySelectedSales', sum(Sales)

            )

        )

    ),

   

sum( Sales))