Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor

Calculate dimension based on expression group by

Hi everybody,

I am creating an app to analyze selling receipts data. 

Below you will find the model: I would create a dimension FLAG which is 1 if SettoreCod='12' and SettoreCod!='15', 0 otherwise. Considering that ScontrinoCod refers to the number of receipts, the goal is to identify the customers who buy the category '12' and not the category '15' (SettoreCod is the id of the category of product).

Is there a way to create this dimension in front-end?

Any help would be appreciated.

Regards,

Marco

 

model.PNG

5 Replies
Highlighted
Champion III
Champion III

Re: Calculate dimension based on expression group by

Try this may be

IF(SettoreCod='12' OR SettoreCod <> '15', 1, 0)
Highlighted
Contributor
Contributor

Re: Calculate dimension based on expression group by

Hi,

thanks for the answer but unfortunately it is not what I am looking for.

I would flag with 1 all the ScontrinoCod that has at least one SettoreCod='12' but NO SettoreCod='15'.

Below an example, thanks for the support

example_flag.png

Highlighted
Champion III
Champion III

Re: Calculate dimension based on expression group by

May be one way you can try like below

= IF(Sum(IF(Match(settoreCod, 12, 15), 1, 0))=1, 1, 0)
Highlighted
Contributor
Contributor

Re: Calculate dimension based on expression group by

unfortunately not, the condition mentioned by you just filter the SettoreCod='12' or SettoreCod='15'
Highlighted
Champion III
Champion III

Re: Calculate dimension based on expression group by

Ok can you share that sample data where you have this issue or a qvw file would help me to work on?