Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum of Flag where distinct column

Hi,

I am trying to sum a flag which i have made for each distinct value in a column called EQUNR within a graph.

In the below code, i am trying to create the above graph with the aggr function and then sum up the SuperiorIndicatorFlag. EQUNR is not unique for every row, so i think i need to use the disctinct function.

Here is my code:

sum(Aggr(distinct EQUNR,SuperiorIndicatorFlag))

for some reason, my graph shows 'No data to display'

Any help would be greatly appreciated.

1 Solution

Accepted Solutions
JonnyPoole
Employee
Employee

Matt, if you add this expression, are you getting numbers greater than 1 for the superior indicator flag ?

sum( SuperiorIndicatorFlag)


If yes , you can try


sum(  aggr(  max( SuperiorIndicatorFlag) , EQUNR) )


...aggregates the highest value ( 1 or nothing) for each EQUNR, then sums up the results.

View solution in original post

1 Reply
JonnyPoole
Employee
Employee

Matt, if you add this expression, are you getting numbers greater than 1 for the superior indicator flag ?

sum( SuperiorIndicatorFlag)


If yes , you can try


sum(  aggr(  max( SuperiorIndicatorFlag) , EQUNR) )


...aggregates the highest value ( 1 or nothing) for each EQUNR, then sums up the results.