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: 
reporting_neu
Creator III
Creator III

SUM by Mapping

Hi,

I need the sum of several fields from a table that I would like to have mapped.

The raw data looks like this:

Konto Amount Paid Discount
100 500 450 15
100 100 97 3
200 501 400 15,03
200 150 145,5 4,5

 

I have to deduct the discount and the amount paid from the claim.

In the script it looks like this:

 

ypA_MAP_FO_OP:
  Mapping LOAD
  Upper(Text(Konto)),
  	Amount - (Paid + Discount) & '|' &
        1 & '|' &
        Konto	 	
From
  $(SCRIPT_PATH_PA_EXPORT)FO_OP.qvd
  (qvd)
Group by Konto;
  

 

 But I get the error message: "aggregation expressions required by group by clause"

If I leave out the grouping, it only takes one value per account. But I need the total values ​​for each account.

The result must look like this:

Konto Sum
100 15
200 75

 

What is wrong? Can you help me?

1 Reply
canerkan
Partner - Creator III
Partner - Creator III

Hi Reporting_neu,

try this:

 

 

 

ypA_MAP_FO_OP:
Mapping Load
Upper(Text(Konto)) as Konto,
Sum(Amount - (Paid+Discount)) & '|' & 1 & '|' & Konto as Result
From ....
(qvd)
Group by Upper(Text(Konto));

 

 

since you didn't have any aggregation function in you calculation, the group by clause couldn't group anything

 

Let me know if it worked.

Regards,

Can