Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

Flag latest date opportunity

Hi All

I have raw data below :-

Opportunity Closing DateOpportunity NumberStage of Opportunity
13-Aug-2017Detail Dicuussion( Prospect)
24-Aug-2017Quotation
25-Aug-2017Order Received
26-Aug-2017Order Received

 

Directory;
LOAD
[Opportunity Closing Date],
[Opportunity Starting Date],
[Opportunity Amount],
[Stage of Opportunity],
[Opportunity Number]
FROM
..\..\..\Dropbox\QV_RAW_ISDN\CRM_PM_.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

May i know how to Flag the latest opportunity which is on 26 Aug 2020 using load script ?

Paul Yeo

2 Solutions

Accepted Solutions
kamielrajaram
Creator III
Creator III

After you load your table load the below table. yourtablename will be the table name you created. The table below will be a new table that has your max date and flag.

MaxClosingOp:

load max([Opportunity Closing Date]) as [Opportunity Closing Date] ,1 as [Last Opportunity Closing Flag] resident yourtablename;

View solution in original post

paulyeo11
Master
Master
Author

Hi Kush

i use your solution , the Flag display mussing value.

paulyeo11_0-1598566406836.png

 

Paul

View solution in original post

9 Replies
kamielrajaram
Creator III
Creator III

Hi,

MaxClosingOp:

load max([Opportunity Closing Date]) as [Opportunity Closing Date] ,1 as [Last Opportunity Closing Flag] resident yourtable;

Left join(yourtable)

Load * resident MaxClosingOp; // this will join on [Opportunity Closing Date]

Drop Table MaxClosingOp;

paulyeo11
Master
Master
Author

Hi Sir

Thank you for your sharing. I get error msg :-

Invalid expression
LOAD
[Opportunity Closing Date],
[Opportunity Starting Date],
[Opportunity Amount],
max([Opportunity Closing Date]) as [Opportunity Closing Date_],


[Stage of Opportunity],
[Opportunity Number]
FROM
..\..\..\Dropbox\QV_RAW_ISDN\CRM_PM_.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)

 

Paul

 

kamielrajaram
Creator III
Creator III

After you load your table load the below table. yourtablename will be the table name you created. The table below will be a new table that has your max date and flag.

MaxClosingOp:

load max([Opportunity Closing Date]) as [Opportunity Closing Date] ,1 as [Last Opportunity Closing Flag] resident yourtablename;

Kushal_Chawda

try below

Directory;

Data:
LOAD
[Opportunity Closing Date],
[Opportunity Starting Date],
[Opportunity Amount],
[Stage of Opportunity],
[Opportunity Number]
FROM
..\..\..\Dropbox\QV_RAW_ISDN\CRM_PM_.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

left join(Data)

load  date(max([Opportunity Closing Date])) as [Opportunity Closing Date],
1 as Latest_Date_Flag
resident Data;

paulyeo11
Master
Master
Author

Hi Kush

i use your solution , the Flag display mussing value.

paulyeo11_0-1598566406836.png

 

Paul

Kushal_Chawda

It's because your Date fields are not in proper date format. set the below variable in main tab as per your data date format

SET DateFormat='DD-MMM-YY';

paulyeo11
Master
Master
Author

Hi Sir

it work fine now.

Assume if i have duplicated row on the latest date , will qlik view know to pick up pick up which row ?

i have try , qlik view still pick up only one row , why  so smart ?

Paul 

paulyeo11
Master
Master
Author

Hi Kush

i need to load mutiple company raw data , I try to make use of the same script for FOR script , now it is not working , any idea how to make it work ?

For Each i in 'PM','LE','DA','PW','SD'
Data:
LOAD
'$(i)' as SOURCE,
[Sales Person] AS Sales_Person,
[Opportunity Name] AS Opportunity_Name,
[Company Name] AS Company_Name,
[Contact Person] AS Contact_Person,
[Opportunity Closing Date] AS Closing_Date,
[Opportunity Closing Date],
[Opportunity Starting Date] AS Starting_Date,
[Opportunity Amount] AS Opp_Amount,
[Stage of Opportunity] AS Stage,
[Probability %] AS Probability,
[Opportunity Number] AS Opp_number
FROM
$(vRAWPath)CRM_$(i).CSV
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
NEXT i;

left join(Data)
load date(max([Opportunity Closing Date])) as [Opportunity Closing Date],
1 as Latest_Date_Flag
resident Data;