Announcements
You can succeed best and quickest by helping others to succeed. Join the conversation.
cancel
Showing results for
Did you mean:
Contributor III

Hello,

I am trying to load some data from a given csv-file.

Very simlified extract of the data:

I have the following requirements:

* if I filter for claim 4711 amount should be 2 (not 4)
* if I filter for claim 4711 the sum of cost should be 25
* if I filter for unit 10 sum of cost should be 25
* if I count the number of claims it should be 3 (not 4)

I already have the idea that in the LOAD I should use the keyword "distinct" - but I don´t know exactly how to do this.

Can anybody give me hints for the LOAD?

Rainer

Labels (2)
• ### Distinct

1 Solution

Accepted Solutions
Creator III

something like that? What is the logic for unit? I can't understand it

Table1:
claim,
sum(amount) as amount,
sum(unit) as unit,
sum(cost) as cost
group by claim
;
claim, amount, unit, cost
4711, 2, 10, 10
4711, 2, 11, 15
4712, 3, 10, 10
4713, 1, 12, 5
];

4 Replies
Creator II

Hi

No you should not be using DISTINCT with the LOAD statement as you do want to load all the rows in the csv.

When you come to the front end of things in charts and tables you should be using DISTINCT in functions like Sum() and Count().

So a count of claims would be Count(DISTINCT claim) and in your example that would return 3.

Regards

MVP & Luminary

Your requirements 1, 2 and 4 might be manageable with a distinct in the load or the UI expressions but not 3. I assume that you need some more logic to prepare all wanted results within a single table and/or to split the task into several tables.

- Marcus

Creator III

something like that? What is the logic for unit? I can't understand it

Table1:
claim,
sum(amount) as amount,
sum(unit) as unit,
sum(cost) as cost
group by claim
;
claim, amount, unit, cost
4711, 2, 10, 10
4711, 2, 11, 15
4712, 3, 10, 10
4713, 1, 12, 5
];

Contributor III
Author