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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
devarasu07
Master II
Master II

Group by dimension

Hi All,

I'm trying to achieve No of week launch by article level with below expected output format, can you advise me. Thanks

No of week launch:

=Aggr((Max(maxSalesDate)-min(minSalesDate))/7,ArticleNo2)

Expected output(no of week launch by article).JPG !

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Or a better solution would be this:

=(Max(TOTAL <ArticleNo2> maxSalesDate)-min(TOTAL <ArticleNo2>minSalesDate))/7

Capture.PNG

View solution in original post

8 Replies
sunny_talwar

You can try this:

=Aggr(NODISTINCT(Max(maxSalesDate)-min(minSalesDate))/7,ArticleNo2)

sunny_talwar

Or a better solution would be this:

=(Max(TOTAL <ArticleNo2> maxSalesDate)-min(TOTAL <ArticleNo2>minSalesDate))/7

Capture.PNG

jayanttibhe
Creator III
Creator III

Hi,

Please note that - NODISTINCT Vs TOTAL - there is huge diff. I.e. if there are more than 1 instance of the chart dimensions - in this case suppose 2 Rows of the dimensions as mentioned following in data model -  then NODISTINCT take account the Facts associated with those separately. However, this is not the Case with TOTAL.

  

ArticleNo2LaunchColor
20180010Winter 2015BLACK
20180010Winter 2015BLACK
sunny_talwar

I am not sure I understand the difference between NODISTINCT and TOTAL here. Can you may be elaborate?

jayanttibhe
Creator III
Creator III

Hi Sunny,

Please find attached example to elaborate my point.

sunny_talwar

I guess I wouldn't use Sum around the aggr() function if I plan to use NODISTINCT, So as long as you are not looking to get a total (which in case of straight table can be achieved using Sum of Rows under Total mode, I will always get the same result for row wise data

Capture.PNG

No are these two functions different? Yes.

Do they have different purposes? Yes

Can one replace the others? Not always, but in this case it can. Also, I would suggest to use TOTAL over NODISTINCT for this particular case

jayanttibhe
Creator III
Creator III

Hey Sunny,

I agree with you. But when Set Analysis comes in play, things become bit complicated.

Quoted swuehl

"The set analysis expression in your inner aggregation function does not define the set of possible values for the AGGR dimension fields. If you need to modify this set (i.e. you want a different set than defined by the selections), you need to use a second set expression in the outer aggregation function."


I always prefer to wrap AGGR with the appropriate Aggregate Function (Most of the cases the Inner aggregate function)

This gives a greater flexibility and accurate results when we amend the expressions with set analysis.


In short, I will never prefer to use the AGGR function without wrapping up the aggregate function


Thanks

Jayant

sunny_talwar

Then why only wrap with Sum my friend? Why not Only or Avg or Min or Max? What made you choose Sum?