Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jonbshaw
Contributor
Contributor

Splitting a value to two decimal places using AGGR function with no remainder

Hi,

Please could someone help me find the solution to the below problem.

=Sum([Gross Amt])/aggr(NODISTINCT count([OrderRef]),[Invoice Number])

Gives me 3,185.54 split exactly 6 ways to equal 530.9233333 on each row.  I need the values to be to two decimal places, but the value has to be exactly 3,185.54, there can't be any remainder, so all of the rows can't equal 530.92 or 530.93

What I have:   
Invoice NumberGross AmtOrder Ref=Sum([Gross Amt])/aggr(NODISTINCT count([OrderRef]),[Invoice Number])
9010313185.5428935801530.9233333
9010313185.5428937601530.9233333
9010313185.5428937701530.9233333
9010313185.5428937901530.9233333
9010313185.5428939301530.9233333
9010313185.5428946801

530.9233333

 

What I need:   
Invoice NumberGross AmtOrder Ref=Sum([Gross Amt])/aggr(NODISTINCT count([OrderRef]),[Invoice Number])
9010313185.5428935801530.93
9010313185.5428937601530.93
9010313185.5428937701530.92
9010313185.5428937901530.92
9010313185.5428939301530.92
9010313185.5428946801530.92

 

Any help would be very much appreciated.

Regards,

Jon

Labels (1)
  • SaaS

2 Replies
Vegar
MVP
MVP

I don't see how you can do what you want to do, but even if all your rows displays 530.92 your totalling should be correct as long you do not change the totalling from the  default (expression total) to Sum of Rows. 

jonbshaw
Contributor
Contributor
Author

Thanks very much for your response.

I need to be able to upload this output into a separate system, so it has to be exact, like in my 'What I need' table.

The total in the Gross Amt column is an invoice total so it can't be changed, the numbers I need in the new column have to equal the Gross Amt when added together, and they have to be to two decimal places.