Qlik Community

Ask a Question

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Partner
Partner

Set Analysis within a bar chart show all years regardless of FY filter picked

I want my bar chart to show ALL years that show YTD counts. Currently using an if statement that works but not as needed. Example: the bar chart shows FY's 2020,2019,2018,2017

Problem:

As soon as the user picks a [Fiscal Year] filter, the remaining years are no shown

The following is the current if statement:

if([Fiscal Year] = $(vFiscalYear),
(Count({$< [Fiscal Year]=, InCurrStartDateYTD= {'1'} >} [SalesContacts])),
if([Fiscal Year] = $(vFiscalYear)-1,
(Count({$< [Fiscal Year]=, In1stPriorStartDateYTD= {'1'} >} [SalesContacts])),
if([Fiscal Year] = $(vFiscalYear)-2,
(Count({$< [Fiscal Year]=, In2ndPriorStartDateYTD= {'1'} >} [SalesContacts])),
if([Fiscal Year] = $(vFiscalYear)-3,
(Count({$< [Fiscal Year]=, In3rdPriorStartDateYTD= {'1'} >} [SalesContacts])),
if([Fiscal Year] = $(vFiscalYear)-4,
(Count({$< [Fiscal Year]=, In4thPriorStartDateYTD= {'1'} >} [SalesContacts]))
)))))

Supporting facts:

vFiscalYear is a variable set for the current FY

The [Fiscal Year] field is from the master calendar

The YTD flags are from the master calendar

It seems this needs to be inside the set analysis only i can't get it to work. Any help would be appreciated.

Thanks team

Labels (2)
1 Solution

Accepted Solutions
Creator III
Creator III

I would create a dimension during load that flags every date as being YTD regardless of year. Something like

If (DayNumberOfYear($1) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] 

where $1 is your date field.

Then your chart, with Fiscal Year as the dimension, can use this measure:

Count({$< [Fiscal Year]=, InYTD= {1} >} [SalesContacts])

 

View solution in original post

1 Reply
Creator III
Creator III

I would create a dimension during load that flags every date as being YTD regardless of year. Something like

If (DayNumberOfYear($1) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] 

where $1 is your date field.

Then your chart, with Fiscal Year as the dimension, can use this measure:

Count({$< [Fiscal Year]=, InYTD= {1} >} [SalesContacts])

 

View solution in original post