Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Rama1
Contributor II
Contributor II

Display required columns based on filter criteria

Hi,

I need help on the below requirement.

I am developing an app in Qlik Sense using data from Excel.

In my pivot table i have 3 dimensions (Company, office fields as rows and date as column)and 1 measure(count(office)).

as i want to display only the latest 6 dates count in my pivot table i wrote a condition for measure as  Count({[WeekSerial]={">$(=max(WeekSerial)-6)<=$(=max(WeekSerial))"}>} [Office])- this displatying only latest 6 dates data.

and i added filter pane with date as dimension. if i am selecting any dates randomly the pivot table is only showing the latest date data For eg: if i select 3 dates in 2019, and 2 dates in 2020 i can only see 2020 dates data.

if i select any dates in 2019 data within 6 weeks i can see all the 6weeks data.

Now my requirement is if i go and select any random dates it should display the selected dates data without any condition and by default it should display based on my expression condition.

For eg: if i select 12/03/2019, 25/04/2019 and 10/02/2020, 16/09/2020 i want all these dates data only.

i also tried this 

if(GetFieldSelections(Date)=0,
Count({1<[WeekSerial]={">$(=max(WeekSerial)-6)<=$(=max(WeekSerial))"}>} [Office]),
count([Office])
)

with this again it is displaying all weeks data  without my expression condition.

Can someone help how can i achieve my requirement.

Thanks in advance.

Thank you.

2 Replies
shanemichelon
Partner - Creator II
Partner - Creator II

I think you are right in using the if function.  But try using GetSelectedCount instead.  Also, are you sure you want to ignore all selections in your set expression (ie 1 instead of $):

if(GetSelectedCount(Date)=0,
  Count({$<[WeekSerial]={">$(=max(WeekSerial)-6)<=$(=max(WeekSerial))"}>} [Office]),
  Count([Office])
  )

 

 

Rama1
Contributor II
Contributor II
Author

Hi shanemichelon,

Thanks for your quick reply.

if(GetSelectedCount(Date)=0,
  Count({$<[WeekSerial]={">$(=max(WeekSerial)-6)<=$(=max(WeekSerial))"}>} [Office]),
  Count([Office])
  )

with this expression i can see all the weeks/dates data as columns in my pivot table excluding my expression condition, but i can see only last/latest 6 dates data count and remaining all the dates it is showing as 0. When i go and filter on the dates then i can see data as for eg: if i select date in 2019 i can see 2019 date data count and if go select 2020 data along with 2019 then 2019 dates data count again showing as 0 and showing 2020 date data count properly.

Any help on this how can i achieve this:

For eg: if i select 12/03/2019, 25/04/2019 and 10/02/2020, 16/09/2020 i want all these dates data only.

Thanks