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: 
Not applicable

Total in staright table

Hi

I have the below straight table

The formula for the total column is  (days*volume*(0.3))+(days*volume)/150  = total

   

employeeiddaysvolumetotal
a1270.0201166770.004707302
a230.0244738130.000636319
a3940.025138260.020479303

My output should be as below

   

employeetotal
a0.025822924

i'm using the below formula i'm getting correct answer if i'm adding the ID field, but i dont want to show ID field and a unique employee

= sum(days* volume*0.3)+ sum(days)*sum( distinct volume) /150

1 Solution

Accepted Solutions
sunny_talwar

Try this:

=Sum(Aggr(Sum(days* volume*0.3) + Sum(days) * Sum(DISTINCT volume) /150, employee, id))

View solution in original post

9 Replies
sunny_talwar

Try this:

=Sum(Aggr(Sum(days* volume*0.3) + Sum(days) * Sum(DISTINCT volume) /150, employee, id))

Not applicable
Author

Hi Sunny its giving me very high value when compared to the actual value

its giving me 23.050 but the value is 0.65143....

employeeiddaysvolumetotal
a19830.764653784219

   

0.651434047
sunny_talwar

Would you be able to share a sample where this isn't working?

shawn-qv
Creator
Creator

Hi John, are you pre-calculating the total amount in your load script?

If not, I would suggest that you consider moving this calculation to the script.

If you're wanting to calculate it in a chart, then I would imagine an expression like the one below would suffice:

sum(((days*volume*0.3)+(days*volume))/150)

screenshot.1.png

S.

Anil_Babu_Samineni

Try to create one variable for 0.3 like

LET Vstatic = num('0.3','##.##0')

Then use this variable in to that expression

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
hemanthaanichet
Creator III
Creator III

Hi John,

Try this..

=Sum(Aggr((Sum(days* volume*0.3) + Sum(days) * Sum(DISTINCT volume)) /150,Employee,Id))

DavidFoster1
Specialist
Specialist

Sunny T's approach would work if the data was just those 3 rows. I suspect that this is not the raw data (the DISTINCT is the main clue).

If my suspicion is correct, please describe or show us the raw data

Not applicable
Author

Hi sunny tanks a lot and the problem is resolved now

Not applicable
Author

Can you please help me out in the below senarios

Creating different kinds of charts and representating data