Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Suxel
Contributor III
Contributor III

create new table based on existing table

Hi,

I would like to create a new table from an existing details table (qvd) that already stored in the application. 

The existing table has all activities each user participated.

DateUserTeamTasksActivities
03.09.2021TinaTeam1TaskAActivity1
04.09.2021TinaTeam1TaskAActivity2
04.09.2021TinaTeam1TaskAActivity3
04.09.2021TinaTeam1TaskAActivity4
04.09.2021TinaTeam1TaskAActivity5
04.09.2021TinaTeam1TaskAActivity6
04.09.2021JudyTeam2TaskBActivity1
04.09.2021JudyTeam2TaskBActivity2
04.09.2021JudyTeam2TaskBActivity3
04.09.2021AlexTeam1TaskAActivity1
04.09.2021AlexTeam1TaskAActivity2
04.09.2021AlexTeam1TaskAActivity3
04.09.2021AlexTeam1TaskAActivity4
03.09.2021BobbyTeam2TaskBActivity1
04.09.2021BobbyTeam2TaskBActivity2
04.09.2021BobbyTeam2TaskBActivity3
04.09.2021BobbyTeam2TaskBActivity4
04.09.2021BobbyTeam2TaskBActivity5
04.09.2021BobbyTeam2TaskBActivity6

 

In my expected result, each user should only appear once a day and if user participates in activity 6 then 50 points, if not 100 points. This new table will be store as another qvd.

DateUserTeamPoints
03.09.2021TinaTeam1100
03.09.2021BobbyTeam2100
04.09.2021TinaTeam150
04.09.2021JudyTeam2100
04.09.2021AlexTeam1100
04.09.2021BobbyTeam250

 

Could anyone help to write the load script?

2 Solutions

Accepted Solutions
Suxel
Contributor III
Contributor III
Author

I have tried to write below script, it seems working. With below script [libA] [libB] are synthetic with "Date", "User", "Team", if "Activities" is filter in chart A, then chart B with "Points" display will go off. How can I remain chart B "Points" display with "Activities" is filter in chart A ?

[Result100]:
LOAD Distinct
"Date",
"User",
"Team",
100 as "Points",
Date("Date",'YYMMDD') & '-' & "User" as "myID"
from [libA] (qvd) where not match ("Activities", 'Activity6');

Concatenate
Load * from [libB] (qvd)
Where not Exists("myID");

Store Result100 into [libB] (qvd);

Drop Table [Result100];

---------------------------------------

[Result50]:
LOAD Distinct
"Date",
"User",
"Team",
50 as "Points",
Date("Date",'YYMMDD') & '-' & "User" as "myID"
from [libA] (qvd) where match ("Activities", 'Activity6');

Concatenate
Load * from [libB] (qvd)
Where not Exists("myID");

Store Result50 into [libB] (qvd);

Drop Table [Result50];

---------------------------------------

Load [libA] (qvd);

Load [libB] (qvd);

 

View solution in original post

Suxel
Contributor III
Contributor III
Author

at the end, I have added an expression on the chart B measures.

Sum({$<[Activities] = >} [Points])

View solution in original post

3 Replies
Suxel
Contributor III
Contributor III
Author

I have tried to write below script, it seems working. With below script [libA] [libB] are synthetic with "Date", "User", "Team", if "Activities" is filter in chart A, then chart B with "Points" display will go off. How can I remain chart B "Points" display with "Activities" is filter in chart A ?

[Result100]:
LOAD Distinct
"Date",
"User",
"Team",
100 as "Points",
Date("Date",'YYMMDD') & '-' & "User" as "myID"
from [libA] (qvd) where not match ("Activities", 'Activity6');

Concatenate
Load * from [libB] (qvd)
Where not Exists("myID");

Store Result100 into [libB] (qvd);

Drop Table [Result100];

---------------------------------------

[Result50]:
LOAD Distinct
"Date",
"User",
"Team",
50 as "Points",
Date("Date",'YYMMDD') & '-' & "User" as "myID"
from [libA] (qvd) where match ("Activities", 'Activity6');

Concatenate
Load * from [libB] (qvd)
Where not Exists("myID");

Store Result50 into [libB] (qvd);

Drop Table [Result50];

---------------------------------------

Load [libA] (qvd);

Load [libB] (qvd);

 

NitinK7
Specialist
Specialist

might be don't do any connection between two table

rename all new table fields or  try to use qualify *

Suxel
Contributor III
Contributor III
Author

at the end, I have added an expression on the chart B measures.

Sum({$<[Activities] = >} [Points])