Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
zet
Contributor III
Contributor III

Fixed Total

Hello,

I have a table with 3 dimensions (Dim1, Dim2,Dim3)

I want to show a table containing :

1st column :  count(Aggr(count(*),Dim1,Dim2,Dim3))

2nd column : count(Aggr(count(*),Dim1,Dim2)) => wich is a total fixed value that I will use in calculating other dimensions

Finally I want something like this 

Dim1Dim2Dim3Total
Line1Line1Line1FixedTotal
Line2Line2Line2FixedTotal

 

Thanks in advance for your help ! 

1 Solution

Accepted Solutions
Anil_Babu_Samineni

You should use TOTAL keyword for outer analysis

Count(TOTAL Aggr(Count(Technique), Number, Place, Type))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

8 Replies
Anil_Babu_Samineni

Please post some rows of data to understand more clear

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
zet
Contributor III
Contributor III
Author

NumberPlaceTypeTechnique
11DG
11DL
12PG
12PL
13AG
14AG

 

I count Technique rows like that : count(Aggr(count(*), Number, Place, Type, Technique))

Technique

Nb Technique

count(Aggr(count(*), Number, Place, Type, Technique))

Total

count(Aggr(count(*),Number,Place,Type))

G4 
D2 

 

I want to calculate  total this way : count(Aggr(count(*),Number,Place,Type)) without considering Technique and it should be the same value for all the rows

In our example Total should be = 4 and not 6

Anil_Babu_Samineni

One more thing, Why you want to exclude "L" from technique to the total, Any logic behind?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
zet
Contributor III
Contributor III
Author

We can consider fields Number,Place,Type as a Place ID and Technique as signal techniques that covers places

so to count the total number of places covered by any signal we should count only occurences by Number,Place,Type

=> Total Number of places=4

=> G=4/4 = 100%

=>L=2/4=50%

mzitouni_0-1605551571141.png

 

Anil_Babu_Samineni

If i understand correctly, Try this way

Count(Aggr(Count(Technique), Number, Place, Type))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
zet
Contributor III
Contributor III
Author

Yes that's how I count Total but I want to make it as a fixed value in all rows so in the same table I want to have 2 different expressions :

Expression 1:  Count(Aggr(Count(Technique), Number, Place, Type, Technique))

Expression 2 : Count(Aggr(Count(Technique), Number, Place, Type)) => Fixed TOTAL

but it doesn't work

Anil_Babu_Samineni

You should use TOTAL keyword for outer analysis

Count(TOTAL Aggr(Count(Technique), Number, Place, Type))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
zet
Contributor III
Contributor III
Author

Works perfectly. Thanks !!!