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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
m_lavova
Contributor
Contributor

Sum numbers and distinct value

Dears,

ist there someone who would help me with me problem, please?

I have data in 3 columns: ASIN, STAR and UNITS SHIPED.

I need to select unique values from ASIN and sum UNITS SHIPED, but only for STAR = 1, 2, 3.

 

it looks like this:

ASIN    STAR   UNITS SHIPED
12             1                     2

12            1                     2

13           4                     1

14           2                     3

14           3                    3

the sum that I need is 5.

I tried a lot of possibilities, but it is not work.

 

Thank you in advance.

1 Solution

Accepted Solutions
agigliotti
MVP
MVP

what about the below expression:
Sum( {< STAR = {'1','2','3'} >} DISTINCT [UNITS SHIPED] )
?
The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it

View solution in original post

10 Replies
agigliotti
MVP
MVP

Hi,
You could try with:
Sum( {< STAR = {'1','2','3'} >} TOTAL <ASIN> DISTINCT UNITS SHIPED )
I hope it could helps.
The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
m_lavova
Contributor
Contributor
Author

 

 Thank you, but it does not work correctly

when I use your condition, I see not good values

Untitled.png

jonathandienst
Partner - Champion III
Partner - Champion III

No need for total, just

Sum({<STAR = {'1','2','3'}>} [UNITS SHIPED])
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
agigliotti
MVP
MVP

with data provided above it does works.
what are dims and measures expressions of your bar chart ?
The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
m_lavova
Contributor
Contributor
Author

dimension is only business segment comes from source data (no expression) and as measure I used your expression

agigliotti
MVP
MVP

could you add "business segment" field to your data above to understand better what are you trying to achieve ?
The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
m_lavova
Contributor
Contributor
Author

ASIN    STAR   BUSINESS SEGMENT     UNITS SHIPED
12             1                          LED                                 2

12            1                          LED                                2

13           4                          TRAD                             1

14           2                           LUM                            3

14           3                           LUM                           3

I need to have similar result as you can see below, but for ASIN only unique values need to be genarated

Untitled.png

agigliotti
MVP
MVP

what about the below expression:
Sum( {< STAR = {'1','2','3'} >} DISTINCT [UNITS SHIPED] )
?
The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
m_lavova
Contributor
Contributor
Author

Thank you very  much,

it works correctly 🙂