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: 
jadams123
Creator
Creator

Quick Question

Hi All:

Question 1:

I want too:

if (today -1) = mon then 0, if (today -1) = tue then 2, if (today -1) = wed then 3...and so on

Question 2:

I want to be able to do this:

How can I group:

1) Group anything other than CX1, CX2, CX3, CX4 in "Other CX type East"


2) Group anything other than CX5, CX6, CX7, CX8 in "Other CX type West"

and so on...

   

GroupCustomer TypeSales
EASTCX1$100.00
EASTCX2$200.00
EASTCX3$300.00
EASTCX4$400.00
EASTOther CX Type EAST$500.00
Total EAST $1,500.00
WESTCX5$600.00
WESTCX6$700.00
WESTCX7$800.00
WESTCX8$900.00
EASTOther CX Type WEST$500.00
Total West $3,500.00

This is my current formula. This obviously just shows sales for CX's

= Sum( {$<GLYEAR = {2017},

CUSTOMER_TYPE = { CX1, CX2, CX3, CX4, CX5, CX7, CX8 },

CREDIT_CODE = {YES}>} AMOUNT )

Thanks,

J

13 Replies
vishsaggi
Champion III
Champion III

May be below? Question 1 and Question 2 you can create something like:

LOAD ....,

Pick(Match(WeekDay(Today()-1), 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'), 0,1,2,3,4,5,6) AS DayNo,

IF(Group = 'EAST'   AND Not Match(CustomerType, 'CX1','CX2','CX3','CX4'), 'Other CX Type EAST',

IF(Group = 'WEST'  AND Not Match(CustomerType, 'CX5','CX6','CX7','CX8'), 'Other CX Type WEST')) AS                                                                                                                                                  AS NewCustTypeField

FROM ....;

jadams123
Creator
Creator
Author

I am not a developer...I can only do calculated fields... first formula work but the second formula is not working..

= Sum( {$<GLYEAR = {2017},

if(CBT = {'EAST'} AND Not Match(CUSTOMER_TYPE_DESCRIPTION = {'CX1',CX2".....}), 'Other Customet Type),

CREDITCODE = {YES}>} AMOUNT )

vishsaggi
Champion III
Champion III

OK can you share your sample app your are working on. You need to differentiate to which Group this CustomerType should be linked. Just in your Load script you have to add this IF statement.

jadams123
Creator
Creator
Author

Not sure I can I share...QV is on my work computer

vishsaggi
Champion III
Champion III

Can you post some sample data onto excel and share. With your expected output.

Digvijay_Singh

Not sure but this may fit in to find the solution at front end only -

It looks like you want to create synthetic dimension from your current customer type dimension. If you are sure that you would have only 10 final dimension values in your output (CX1..4, CX5..8, 'Other CX Type EAST' and Other CX Type WEST) then you can use valuelist() to create synthetic dimension.


Dimension -

=Valuelist('CX1','CX2','CX3','CX4','Other CX Type EAST','CX5','CX6','CX7','CX8','Other CX Type WEST')


Expression -

Pick(Match(Valuelist('CX1','CX2','CX3','CX4','Other CX Type EAST','CX5','CX6','CX7','CX8','Other CX Type WEST'),

  'CX1','CX2','CX3','CX4','Other CX Type EAST','CX5','CX6','CX7','CX8','Other CX Type WEST'),

   Sum({$<GLYEAR={2017},CUSTOMER_TYPE = {'CX1'}, CREDIT_CODE = {'YES'}>} AMOUNT ),

   Sum({$<GLYEAR={2017},CUSTOMER_TYPE = {'CX2'}, CREDIT_CODE = {'YES'}>} AMOUNT ),

   Sum({$<GLYEAR={2017},CUSTOMER_TYPE = {'CX3'}, CREDIT_CODE = {'YES'}>} AMOUNT ),

   Sum({$<GLYEAR={2017},CUSTOMER_TYPE = {'CX4'}, CREDIT_CODE = {'YES'}>} AMOUNT ),

   Sum({$<GLYEAR={2017},CUSTOMER_TYPE = {"=if(Match(CUSTOMER_TYPE,'CX1','CX2','CX3','CX4')=0 and Group='EAST'"}, CREDIT_CODE = {'YES'}>} AMOUNT ),

   Sum({$<GLYEAR={2017},CUSTOMER_TYPE = {'CX6'}, CREDIT_CODE = {'YES'}>} AMOUNT ),

   Sum({$<GLYEAR={2017},CUSTOMER_TYPE = {'CX7'}, CREDIT_CODE = {'YES'}>} AMOUNT ),

   Sum({$<GLYEAR={2017},CUSTOMER_TYPE = {'CX8'}, CREDIT_CODE = {'YES'}>} AMOUNT ),

   Sum({$<GLYEAR={2017},CUSTOMER_TYPE = {'CX9'}, CREDIT_CODE = {'YES'}>} AMOUNT ),

   Sum({$<GLYEAR={2017},CUSTOMER_TYPE = {"=if(Match(CUSTOMER_TYPE,'CX5','CX6','CX7','CX8')=0 and Group='WEST'"}, CREDIT_CODE = {'YES'}>} AMOUNT ))

You would need to format set expression to make them workable.

jadams123
Creator
Creator
Author

This is what I am trying to do...

data:

   

YearCustomer CodeCustomer TypeSalesCustomer Type2
2017COPDIS$100.00DIS
2017COPIDI$101.00IDI
2017COPIFR$102.00IFR
2017COPIGT$103.00COP Other
2017COPINI$104.00COP Other
2017COPITC$105.00COP Other
2017COPKCN$106.00COP Other
2017COPRTH$107.00COP Other
2017COPSAM$108.00COP Other
2017COPSTP$109.00COP Other
2017ESTAMB$110.00AMB
2017ESTAME$111.00AME
2017ESTAMP$112.00AMP
2017ESTAVR$113.00AVR
2017ESTBCT$114.00BCT
2017ESTBED$115.00BED
2017ESTBLB$116.00BLB
2017ESTBRI$117.00BRI
2017ESTCFF$118.00EST Other
2017ESTCHN$119.00EST Other
2017ESTCRP$120.00EST Other
2017ESTCRS$121.00EST Other
2017ESTDIS$122.00EST Other
2017ESTEPQ$123.00EST Other
2017ESTFRR$124.00EST Other
2017ESTFRM$125.00EST Other
2017ESTFST$126.00EST Other
2017ESTGRM$127.00EST Other
2017ESTGTG$128.00EST Other
2017ESTHIF$129.00EST Other
2017ESTHPT$130.00EST Other
2017ESTIBU$131.00EST Other
2017WSTASG$163.00ASG
2017WSTASK$164.00ASK
2017WSTBLL$165.00BLL
2017WSTBLR$166.00BLR
2017WSTCHR$167.00CHR
2017WSTCMP$168.00CMP
2017WSTCRM$169.00CRM
2017WSTDAD$170.00WST Other
2017WSTDIS$171.00WST Other
2017WSTDRN$172.00WST Other
2017WSTEGS$173.00WST Other
2017WSTFAM$174.00WST Other
2017WSTFED$175.00WST Other
2017WSTFRM$176.00WST Other
2017WSTGRM$177.00WST Other
2017WSTGTG$178.00WST Other

pivot

   

Sum of Sales
Customer CodeCustomer Type2Total
COPCOP Other$742.00
DIS$100.00
IDI$101.00
IFR$102.00
COP Total $1,045.00
ESTAMB$110.00
AME$111.00
AMP$112.00
AVR$113.00
BCT$114.00
BED$115.00
BLB$116.00
BRI$117.00
EST Other$1,743.00
EST Total $2,651.00
WSTASG$163.00
ASK$164.00
BLL$165.00
BLR$166.00
CHR$167.00
CMP$168.00
CRM$169.00
WST Other$1,566.00
WST Total $2,728.00
(blank)(blank)
(blank) Total
Grand Total $6,424.00
Anil_Babu_Samineni

Like this?

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vishsaggi
Champion III
Champion III

Check this? I copied your table data onto Excel sheet. What is your data source is that Excel or some other data bases?

Table1:

LOAD [Customer Code],

    [Customer Type],

    [Customer Type2],

    SalesField,

    Year

FROM

[..\Desktop\Sample1.xls]

(biff, embedded labels, table is Sheet1$);

Capture.PNG