Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
anwarbham
Contributor III
Contributor III

previous 6 month expression not working

Hi guys im confused why a simple expression to get the last 6 month data wont bring me any results

i have a master calender the one below

image.png

Qlik sense represents the date Field as '18/02/2020'

I have a simple expression to get the last 6 month data but it wont yield any results.

 

Count({$<_DataSource_F_Call$(vLiz_Set_SnapshotSwitch)={1},_ChannelCriteria={1},_IndividualCustomer={1},Timeframe={MTH},$(vLiz_Set_Territory),Product=, Date = {'>=$(=addmonths(today(),-6))'}>} DISTINCT Contact_Cnt)

 

 

but I do get the last 6 month data if i use this 

 

Count({$<_DataSource_F_Call$(vLiz_Set_SnapshotSwitch)={1},_ChannelCriteria={1},_IndividualCustomer={1},Timeframe={MTH},$(vLiz_Set_Territory),Product=, 
Month= {
"$(=Month(addmonths(Today(),-6)))",
"$(=Month(addmonths(Today(),-5)))",
"$(=Month(addmonths(Today(),-4)))",
"$(=Month(addmonths(Today(),-3)))",
"$(=Month(addmonths(Today(),-2)))",
"$(=Month(addmonths(Today(),-1)))",
"$(=Month(Today()))"
},
Year = {"$(=Year(Today()))"}>} DISTINCT Contact_Cnt)

 

can anyone tell me why or help 

 

Thanks

 

 

Labels (2)
1 Solution

Accepted Solutions
anwarbham
Contributor III
Contributor III
Author

Fixed with the below codeas en example for 12 month 

Count({$<_DataSource_F_Call$(vLiz_Set_SnapshotSwitch)={1},_ChannelCriteria={1},_IndividualCustomer={1},Timeframe={MTH},$(vLiz_Set_Territory), 
Date = {">=$(=date(addmonths(today(),-12),'DD/MM/YYYY'))"}  >}  DISTINCT Contact_Cnt)

View solution in original post

5 Replies
Kushal_Chawda

try with double quotes

Count({$<_DataSource_F_Call$(vLiz_Set_SnapshotSwitch)={1},_ChannelCriteria={1},_IndividualCustomer={1},Timeframe={MTH},$(vLiz_Set_Territory),Product=, Date = {">=$(=addmonths(today(),-6))"}>} DISTINCT Contact_Cnt)
anwarbham
Contributor III
Contributor III
Author

it works if I remove the equal sign

Date = {">=$(addmonths(today(),-6))"}

instead of 

Date = {">=$(=addmonths(today(),-6))"}

only problem is if I don't have the current year in selection it includes data from previous year 

Kushal_Chawda

What do you want to achieve?

anwarbham
Contributor III
Contributor III
Author

I just need to count the last 6 month from today and the last 24 month from today, without selecting the year 

anwarbham
Contributor III
Contributor III
Author

Fixed with the below codeas en example for 12 month 

Count({$<_DataSource_F_Call$(vLiz_Set_SnapshotSwitch)={1},_ChannelCriteria={1},_IndividualCustomer={1},Timeframe={MTH},$(vLiz_Set_Territory), 
Date = {">=$(=date(addmonths(today(),-12),'DD/MM/YYYY'))"}  >}  DISTINCT Contact_Cnt)