Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I successfully removed duplication using group by but when I add date field I am getting duplication, how to remove the duplications in this case?
thanks in advance.
you mean max(date(floor(datefield)))
yes
duplicates are reflecting, for better understanding I will give example
ID DATE TIME Priority Service
A 25/07/2017 100 3 XYZ
A 26/07/2017 0 3 XYZ
A 27/07/2017 10 3 XYZ
B 26/07/2017 150 3 ABC
B 28/07/2017 0 3 ABC
I want the output as
ID DATE TIME Priority Service
A 27/07/2017 110 3 XYZ
B 28/07/2017 150 3 ABC
Load
ID,
Max(DATE) as DATE,
sum(TIME) as TIME,
Priority,
Service
From Table
group by ID,
Priority,
Service;
Hi Shraddha,
I did the same but getting duplicates
then it will be better if you share your sample app
can youu help me again qvw application to your reply
Hi,
Can you provide your sample app???
also mention from where you want to achieve it i.e. from front end or in script..
If you want it in script then logic suggested by shraddha.g must work, you have to modify it as per your requirement.
Or if you want in front end then take straight table
take ID as dimension
and expression
1:max(date)
2: sum(time)
3: max(Priority)
4: Only(Service)
Regards,
try this
Data:
LOAD * Inline [
ID, DATE, TIME, Priority, Service
A, 25/07/2017, 100, 3 , XYZ
A, 26/07/2017, 0 , 3 , XYZ
A, 27/07/2017, 10 , 3, XYZ
B, 26/07/2017, 150, 3 , ABC
B, 28/07/2017, 0, 3 , ABC ];
Inner Join(Data)
LOAD ID,
sum(TIME) as TimeNew,
max(DATE) as DATE
Resident Data
Group by ID;
drop field TIME;
rename field TimeNew to TIME;
Note: Replace inline table with your actual data table
thanks for the solution its working fine but a small issue in it, for particular ID two dates are same so how to get only one from it