Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
how to do Distinct count of customer if last transaction is within date filter criteria. If no date filter is selected then criteria is YTD start date and end date???
Can you give few more details related your requirement.
i need to write a logic in which i need to get distinct count of customer if the transaction is with in date filter criteria. If any date does not get selected then it show data of YTD start date and end date??? Can you pls help??
So is it like you want the distinct count(Data) for selected date range or date and if nothing is selected the values from YTD Start to YTD End should be counted?? Can you please share some data or sample qvw.
And Please uncheck the correct answer, Some of the expert can come to help if the question is still unanswered. Once you get your answer, then mark it as correct answer. Welcome to Qlik
As i assume, This?
If(GetFieldSelections([last transaction])=0, count({<Year=, Month=, Quarter=, Week=, [last transaction]={">=$(=Num(YearStart(Max([last transaction]))))<=$(=Max([last transaction]))"}>} customer),
Count({<[last transaction] = {"$(=FirstSorterValue([last transaction], -Aggr(Sum(customer,[last transaction])))"}>}DISTINCT customer))
Or
If(GetFieldSelections([last transaction])>=2, count({<Year=, Month=, Quarter=, Week=, [last transaction]={">=$(=Num(YearStart(Max([last transaction]))))<=$(=Max([last transaction]))"}>} customer),
Count({<[last transaction] = {"$(=FirstSorterValue([last transaction], -Aggr(Sum(customer,[last transaction])))"}>}DISTINCT customer))
Anil, Shouldn't we use GetSelectedCount() instead of GetFieldSelections() in the expression above?? Am not completely familiar with qlikview. Just asking.
We can use the same like GetSelectedCount([last transactio])>=2. The reason i used is today morning i got one issue while this so that i can use Field instead of Selected. It works some cases and may be frustrate on few cases
i need the count of customer when user selects particular date in date filter.But if there is no date selected it will show data of ytd .
For first one it will come direct.
If(GetFieldSelections([last transaction])=0, YTD Formulae,count(customer))