Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

joshuagoh
New Contributor

Add additonal row to table

Hi all,

I was wondering if the following is possible to perform in Qliksense.

1) I have imported an excel with the following sales data.

eg.

CustomerName | SalesPrice

John                  | $35

Jane                  | $40

Joe                    | $50

2) I have put this into a table  to display and would like to add an additional row from another excel for some adjustments.

eg.

CustomerName | SalesPrice | Reason

John                  | $35             |

Jane                  | $40             |

Joe                    | $50             |

                          | ($20)          | Adjustments


3) Then I would like to sum the total.

eg.

CustomerName | SalesPrice | Reason

John                  | $35             |

Jane                  | $40             |

Joe                    | $50             |

                          | ($20)          | Adjustments

Total                  | $105

Can I check if this is possible to perform in a single table? or is there any other recommendations on performing this?

Thank you!

1 Reply
felipedl
Valued Contributor III

Re: Add additonal row to table

Hi Josh,

Saying you imported both files (i'm doing with inline load, that lets me load directly from script) you could use the below code:

table1:

Load * Inline

[

CustomerName | SalesPrice

John                  | 35

Jane                  | 40

Joe                    | 50

] (ansi, txt, delimiter is '|', embedded labels);

table2:

Load * Inline

[SalesPrice | Reason

                          -20          | Adjustments

](ansi, txt, delimiter is '|', embedded labels);;

Concatenate (table1)

Load

*

Resident table2;

drop table table2;

The Concatenate statement lets you perform what you want, by appending both tables. If there are equaly named fields, the new table gets them into a same column and as a result i got:

sample.png