Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
risabhroy_03
Partner - Creator II
Partner - Creator II

Values getting wrong after removing filter

Hi, I have a table that shows region wise data where region is like East1, East2……

When i remove filters from region the overall value of region is coming wrong, but when i select that particular region from filter it is coming correct.

below is my expression - 

 

Sum({<BillDate={">=$(=monthstart(max(BillDate)))"},ProductCode=P({<DType={2},BillDate={">=$(=monthstart(max(BillDate)))"}>}ProductCode)>} Sales)

 

Labels (3)
2 Replies
marcus_sommer

I think you couldn't use this kind of statement:

{">=$(=monthstart(max(BillDate)))"}

to get the mentioned view because this creates an adhoc-variable which is evaluated ones globally against the available data-set without any considering of the object-dimensionalities and then applied for each row.

To get it evaluated on a row-level you may need a logic like:

if(BillDate >= monthstart(max(BillDate)), sum())

whereby this logic might become tricky to apply in regard to your further conditions and therefore it might be easier to transfer the if-loop into the set analysis syntax, maybe with something like this:

Sum({<BillDate={"=BillDate>=monthstart(max(BillDate))"},
               ProductCode=P({<DType={2},
                                                      BillDate={"=BillDate>=monthstart(max(BillDate))"}>}
               ProductCode)>} Sales)

Gabbar
Specialist
Specialist

When you select Filters the filter is also applied to the inner possible expression.
Let me try to explain it a little :- lets take an example where there two regions A and B:
When you Select Region A your expression becomes :-
Sum({<BillDate={">=$(=monthstart(max(BillDate)))"},Region={'A'},ProductCode=P({<DType={2},Region={'A'},BillDate={">=$(=monthstart(max(BillDate)))"}>}ProductCode)>} Sales)

But when you don't select any region 
the output generated for region A in the table will be according to this expression where any region is possible for possible expression:-
Sum({<BillDate={">=$(=monthstart(max(BillDate)))"},Region={'A'},ProductCode=P({<DType={2},BillDate={">=$(=monthstart(max(BillDate)))"}>}ProductCode)>} Sales)

So the Product Code Coming From region B, which might have value in A will also be shown.
i dont know you data but 
try this:
Sum({<BillDate={">=$(=monthstart(max(BillDate)))"},DType={2},ProductCode=P({<DType={2},BillDate={">=$(=monthstart(max(BillDate)))"}>}ProductCode)>} Sales)

IF require any more help please provide a sample data with output coming and Expected output.