Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
apichana
Contributor III
Contributor III

Please help verify my coding

Hi, 

 I would like to ask for some help to verify my coding on Qlik Sense. My requirement is I want to count Plate_No who never fill GASOHOL E20  or  GASOHOL E85 at all in each month.  Below is my coding and sample of data. I add 3 calculate fields  'Plate_Month' , 'E20E85_Consumption' and 'Action_Need' 

If user fills E20 or E85 , 1 will be show on E20E85_Consumption, If not 0 will be there. 

And if user didn't fill E20 or E85 at all for each month " Action Need" will show on Action_Need field otherwise 'OK'. Action_Need filed come from

 If(Sum(E20E85Consumption)/Count(PLATE_Month) = '0','Action Need','Ok') as Action_Need

 Resident Fleet_Card
Group by PLATE_Month;

So I'm not sure my logic and coding are correct or not please help verify. Thank you. 

Fleet_Card: 

LOAD
Date([POST_DATE]) AS [POST_DATE-PostDate],
Month([POST_DATE]) AS [POST_MONTH-PostDate],
TRN_DATE as Date,
TRN_TIME,
COMPANY_NAME,
CUSTOMER_ID,
CREDIT_LINE,
DRIVER_NAME,
CARD_NO,
PLATE_NO,
PLATE_NO&'_'&TRN_DATE as PLATE_DATE,
PLATE_NO&'_'& Month(TRN_DATE) as PLATE_Month,

if(day([POST_DATE])<=25,month([POST_DATE]),month(AddMonths([POST_DATE],1))) AS [PostDate_MonthNew],
day([POST_DATE]) AS [AAA],

if([PRODUCT_NAME] ='GASOHOL E20'or 'GASOHOL E85',1,0) as E20E85Consumption,

RowNo() as RowCount

FROM [lib://FM/Fleet_Card_*.qvd]
(qvd)

Plate_RowCount:
Load
PLATE_Month,
Count (RowCount) as PlateRowCount,
If(Sum(E20E85Consumption)/Count(PLATE_Month) = '0','Action Need','Ok') as Action_Need
Resident Fleet_Card
Group by PLATE_Month;

 

Post_DatePlate_NoPlate_Month User Product E20E85_Consumption Action_Need 
01-Jan-2112341234_JanAADIESEL B7                     0Action Need 
10-Jan-2112341234_JanAADIESEL B7                     0
01-Jan-2122221234_JanBBGASOHOL E20                   1Ok
12-Jan-2122222222_JanBBGASOHOL E285                  1
13-Jan-2122222222_JanBBGASOHOL91                     0
02-Jan-2133333333_JanCCGASOHOL E20                   1Ok
08-Jan-2133333333_JanCCGASOHOL E20                   1
01-Feb-2112341234_FebAADIESEL B7                     0Ok
05-Feb-2112341234_FebAAGASOHOL E20                   1
12-Feb-2122222222_FebBBGASOHOL E285                  1Ok
13-Feb-2122222222_FebBBGASOHOL E20                   1
02-Feb-2133333333_FebCCDIESEL B7                     0Action Need 
08-Feb-21333333333_FebCCDIESEL B7                     0
0 Replies