Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi. I would like to count the total number of values from a field XMETXT, but at the same time consider the selection (in this case company code = Bukr).
So don't count over ALL values, but only the number of all values in a company code (even if further selections are added).
I tried it like this:
Count(Distinct {1} [XMETXT]) --> Then ALL is counted.
But I would like to have something like this, i.e. only the values from the company code that was selected.
Count(Distinct {1<Bukr={}>}Bukr} [XMETXT])
If no Bukr is given, the selection should then show EVERYTHING.
Is that understandable??!! I hope so!!!
Thank you!!!
Translated with www.DeepL.com/Translator (free version)
Try below expression .
count(distinct {1<$(=if(len('$(=GetFieldSelections(company_code))')>1,'company_code','company_code1'))={'Bukr'}>}XMETXT)
Thank you very much. I'll try it another way - step by step.
This code takes the BUKRS 0381 and counts up:
Count({$<[BUKRS]={'0381'}>}[XMETXT])
Now I want to take any value from the BUKRS field (instead of 0381), e.g. 0382, 0441, etc.
This code goes in the right direction - but does not work.
Count({$<[BUKRS]={'$(=GetFieldSelections([BUKRS]))')}>}[XMETXT])
Where is the error?
As below
=Count(Distinct {<CompanyCode=p(CompanyCode) >} [XMETXT])
But even without this, this is default Qlik behavior to only show associated data
If you select CompanyCode = BUKR, you will automatically be only counting any XMETXT values associated to companycode =BUKR
=count( [XMETXT]) will give you same result