SUM Function Example

Contributor

SUM Function Example

I tried to create a simple SUM function.

In a video it explains transaction as Line Item whereas I failed it as Line Item.

So I tried using Transaction as a List. It worked out.

 

Can you please let me know, if I am right or wrong?

I have shared Screenshots for reference.

5 REPLIES 5
Community Boss

Re: SUM Function Example

@Marble_Rock ,

 

So, you are not there, but we can get you there.  When you are doing a sum, the line item has to be a number (like you have in Sales), but the what you are summing on has to be a list formatted line item (the Product or Consumer, in your picture).  If these are Text formatted, then they will not work.  So, there are two ways around this:

  • The ideal way is make the Product and Consumer list formatted to the correct lists (presumably Product Flat and Consumer Flat) or
  • keep them as text, and create two line items
    • Product List: Finditem(Product Flat, Product)
    • Consumer LIst: Finditem(Consumer Flat, Consumer)

Now your formula in the target module (if it is dimensionalized by Product Flat would be: Sum Source Module.Sales[sum: Product] or if you did it the 2nd way, Sum Source Module.Sales[sum: Product List].  If you have both Consumer Flat and Product Flat in your target module, the formula would be: 

  • First way: Sum Source Module.Sales[sum: Product, sum Consumer]
  • Second way: Sum Source Module.Sales[sum: Product List, sum Consumer List]

Just remember, when you are doing a sum, the line items within the brackets have to be formatted as a List.

 

Hope this helps,

 

Rob

Message 2 of 6
Highlighted
Contributor

Re: SUM Function Example

Thanks Rob for taking time to answer.

 

I am sorry, I wasn't able to put my doubt precisely. Let me explain my exact question.

 

The video explains:

Transaction as Line Item,

Product as List-Formatted Line Item,

Consumer as List-Formatted Line Item.

 

What I have done is:

Transaction as List,

Product as List-Formatted Line Item,

Consumer as List-Formatted Line Item.

 

I tried with Transaction as a Line Item. But all three (Product, Consumer, Transaction) as a Line Item. Didn't yield a proper result.

 

So I made Transaction to List and it worked out perfectly.

 

Kindly assist me in this.

Message 3 of 6
Community Boss

Re: SUM Function Example

@Marble_Rock ,

 

I am confused because your last picture has all of it done correctly...You are summing the Sales data from the Source Module by two different list formatted line items (Product and Consumer).  If you wanted just the Sales data by Products, then your Result Module would dimensionalized by Product with your formula being Source Module.Sales[Sum: Product].

 

Rob  

Message 4 of 6
Contributor

Re: SUM Function Example

Thanks Rob for taking your time in responding.

 

Let me explain you in detail where is my query. 

 

The Youtube Video explains Transaction as Line Item.

 

Whereas myself trying Transaction as Line Item was giving error.

 

So I tried with Transaction as a List and received the desired result using SUM Function.

 

Please share your input on my understandings.

Message 5 of 6
Community Boss

Re: SUM Function Example

@Marble_Rock ,

 

Sales is a line item as well as Product and Consumer on the the Transaction List, essentially metadata about that transactional line (think invoice ID).  What the exercise is wanting you to do is to sum up the all sales by the product as well as the consumer, not the transactional ID.  When using a sum, the items between the brackets ([ ]) have to be dimensions of the target module defined either on the rows, columns, or page axis (what your are wanting to sum by).  Since your target module does not have the Transactional list on the"outside" of the house (rows, columns, or page axis), the sum will not work with the transactional list as part of the sum function.

 

Hope this helps,

Rob

Message 6 of 6