Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

help with an expression

I think I'm overlooking something ... maybe someone can help me get on the track again.

I have a table which looks something like this:

Servicefact.ServiceOrderNo

Servicefact.RowNo

Servicefact.ArticleCode

Servicefact.Article

....

A ServiceOrderNo only has 1 Article (so no different articles)

A ServiceOrderNo zero or more ArticleCode (Parts that are used)

e.g.

ServiceOrderNoRowNoArticleCodeArticle
SO12341CR3032PP01
SO12342IP20102/RPP01
SO12351CR3032PP02
SP12361AT212/R2PP01
SP12371CR3023PP02
SP12372AT2112/R2PP02
SP12381CR3023PP03

I have overviews for:

Article - ArticleCode ... number of ServiceOrderNo.

But now I'm looking for the opposite, but then a little different.

ArticleCode - total number of ServiceOrderNo for Article (on which the ArticleCode is used)

                         also the ServiceOrderNo which have the same Article but not the ArticleCode!!!

e.g.

ArticleCodeNumberOfSO

explanation

CR30325is used in articles PP01/PP02/PP03 -- sum of all article (also where ArticleCode is not used)
IP20102/R2

is used in article PP01 -- sum PP01 serviceorderno

AT212/R24is used in article PP01/PP02 -- sum of PP01 / PP02 serviceorderno
......

Anyone got a good suggestion how to fix this one??

thx in advance!!

Anita

6 Replies
Michiel_QV_Fan
Specialist
Specialist

Untested:

if(isnull(ArticleCode) = 0 and isnull(ArticleCode) = 0, count(ServiceOrderNo), 0) for counting where article where ArticleCode is used.

if(isnull(ArticleCode) = 0, count({1<Article = p(Article)>}ServiceOrderNo)) for the second one

Anonymous
Not applicable
Author

Never used the part:

{1<Article = p(Article)>}

Using this it seems my date selection is not taken in to account (didn't mentioned this in the example, but there is also a date involved).

rgrds Anita

Not applicable
Author

What about 1 to $ to use other filters?

{$<Article = p(Article)>}

Not applicable
Author

Why not just use an open declaration for the ArticleCode and then the possible for article.

So it would be Count({<ArticleCode = , Article = P(Article)>}ServiceOrderNo).

Also are you trying to use this for a table or just as a one off expression, since the dimensions of the table may mean you need different expression.

Anonymous
Not applicable
Author

I have a date selection (e.g. year/month) ...

And the only dimension used is ArticleCode ... but the expression needs the Article count ...

I already tried to use Count({<ArticleCode = , Article = P(Article)>}ServiceOrderNo) but this didn't do the trick.

rgrds

Not applicable
Author

If you want to pull the value into a table then it's much easier to just calculate it in the back end.

Just use the group function in your script to get a number, mine looked like this:

NumberOfSO:

Load

Article,

Count(ServiceOrderNo) as NumberOfSO

Resident Data

Group By Article;

Obviously you would need to use whatever resident you are holding the data in. To get the value you are after then just use sum(NumberOfSO).