Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
marco_saku
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

Labels (2)
5 Replies
vishsaggi
Champion III
Champion III

Try this may be

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

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

vishsaggi
Champion III
Champion III

May be one way you can try like below

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

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

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