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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
nevilledhamsiri
Specialist
Specialist

How to make appear exact reason againts expenses with negative variance

Hi,

Dear friends!

I have created following table after loading two Excel files as attached below. I need to make appear the reason which I pick up from an expression which too stated below. I have used a set expression to do this but the reason wont come there.For staff salaries of branch RA, I need to bring reason-1 which is "unbudgeted Expense". Also If need to bring reason-1, 2 & 3 before this expense type how it should be done.

Expression used as follows:

SUM({<BR_CODE={'RA'},TYPE={'STAFF SALARIES'}>}REASON_1)

Please see what & where I have gone wrong. You may suggest me a good expression to do this. This is a sample data & same process I need to do for may be around good 40 to 50 records!

Also If I am to  show only expenses type with negative variance excluding positive expenses type, what could be the expression to be used?

EXCEL-1

        

BR_CODECATEGORYNOTE_CODETYPEACT_MONTHBUD_MONTHVARIANCE_MONTHACT_CUMULATIVEBUD_CUMULATIVEVARIANCE
RASTAFF EXPENSES500STAFF SALARIES988,677.41973,840.00-14,837.417,507,077.417,480,400.00-26,677.41
RASTAFF EXPENSES513STAFF WELFARE45,159.0628,000.00-17,159.06242,390.18224,000.00-18,390.18
RASELLING EXPENSE702BUSINESS PROMOTION89,324.7928,725.00-60,599.79259,798.33229,800.00-29,998.33
EMSTAFF EXPENSES500STAFF SALARIES1,000,000.00973,840.00-14,837.418,500,000.007,480,400.00-26,677.41
EMSTAFF EXPENSES513STAFF WELFARE45,159.0628,000.00-17,159.06350,000.00224,000.00-18,390.18
EMSELLING EXPENSE702BUSINESS PROMOTION89,324.7928,725.00-60,599.79259,798.33229,800.00-29,998.33

EXCEL-2

  

SORTING_CODETYPEREASON_1REASON_2REASON_3REASON_4REASON_5
1STAFF SALARIESUnbudgeted_ExpenseNew_Recruits_MESNew_Recruits_UnderwritersNew_Recruits_ASMNew_Recruits_accounts
2STAFF WELFAREWedding Gift_UWWedding Gift_MEWedding Gift_ManagerTea related ExpensesStaff_Uniform_Peon
3BUSINESS PROMOTIONTown_StormingCustomer Get togetherFinance company cocktalDonation

Thanks in advance

Good luck

Neville

26 Replies
nevilledhamsiri
Specialist
Specialist
Author

Dear Tharindu,

Thanks a lot for your response, but the expression seems to be not working!. Have your tried on your own. Please look in to this. If the reasons to b picked just through concat, how the excel table to be changed thereby will not require to develop the said formula with so many addition since I need to link more than 14 Branches over 10 to 15 type of expenses

Neville

dinuwanbr
Creator III
Creator III

Dear Neville,

only link between these two tables is nothing but the TYPE. But clearly there is no direct relationship for REASONS from BR_CODE and TYPE Combination.

So if you can create a mapping table to create this relationship it will work.

Hope you understand what I say.

Rgds,

Tharindu

nevilledhamsiri
Specialist
Specialist
Author

Dear Tharindu,Vishwarath

Could you explain me how this mapping table is created! I need  the reasons given in me 2nd excel file to be linked to 1st excel file. If I have given one reason for business promotion of RA then only that reason to be linked to RA under Business promotion!

Thanks neville

vishsaggi
Champion III
Champion III

Sorry Neville, for this you have to give us more information on how Types are linked to your BRCode. You are saying if BR CODE is EM it should pick reasons1 and Reason2 etc. So, we should know how this BRCode is linked to the Reason. As Rana suggested the should be some kind of mapping to this table. Hows your actual data model looks like? Can you email me we can set up a call for a quick discussion.

Thanks,

V.

nevilledhamsiri
Specialist
Specialist
Author

Dear Vishwarath,

This is the 1t table which has 4 dimension. 2nd table carries all dimensions. A link can be created through BR code & type since both are present in both table.Could you use your knowledge & think how this could be handled. As you say if a link can e created with Branch vs Reason matter will be solved!

Regds

Neville

         

BR_CODECATEGORYNOTE_CODETYPEACT_MONTHBUD_MONTHVARIANCE_MONTHACT_CUMULATIVEBUD_CUMULATIVEVARIANCE
RASTAFF EXPENSES500STAFF SALARIES988,677.41973,840.00-14,837.417,507,077.417,480,400.00-26,677.41
RASTAFF EXPENSES513STAFF WELFARE45,159.0628,000.00-17,159.06242,390.18224,000.00-18,390.18
RASELLING EXPENSE702BUSINESS PROMOTION89,324.7928,725.00-60,599.79259,798.33265,000.00-29,998.33
EMSTAFF EXPENSES500STAFF SALARIES1,000,000.00973,840.00-14,837.418,500,000.007,480,400.00-26,677.41
EMSTAFF EXPENSES513STAFF WELFARE45,159.0628,000.00-17,159.06350,000.00500,000.00-18,390.18
EMSELLING EXPENSE702BUSINESS PROMOTION89,324.7928,725.00-60,599.79259,798.33229,800.00-29,998.33

2ND TABLE

       

BRTYPEREASON_1REASON_2REASON_3REASON_4REASON_5
RASTAFF SALARIESUnbudgeted_ExpenseNew_Recruits_MESNew_Recruits_UnderwritersNew_Recruits_ASMNew_Recruits_accounts
EMSTAFF SALARIESUnbudgeted_ExpenseNew_Recruits_MES
RASTAFF WELFAREWedding Gift_UWWedding Gift_MEWedding Gift_ManagerTea related ExpensesStaff_Uniform_Peon
EMSTAFF WELFARETea related Expenses
RABUSINESS PROMOTIONTown_StormingCustomer Get togetherFinance company cocktalDonation
EMBUSINESS PROMOTIONTown_Storming
nevilledhamsiri
Specialist
Specialist
Author

BR_CODECATEGORYNOTE_CODETYPEACT_MONTHBUD_MONTHVARIANCE_MONTHACT_CUMULATIVEBUD_CUMULATIVEVARIANCE
RASTAFF EXPENSES500STAFF SALARIES988,677.41973,840.00-14,837.417,507,077.417,480,400.00-26,677.41
RASTAFF EXPENSES513STAFF WELFARE45,159.0628,000.00-17,159.06242,390.18224,000.00-18,390.18
RASELLING EXPENSE702BUSINESS PROMOTION89,324.7928,725.00-60,599.79259,798.33265,000.00-29,998.33
EMSTAFF EXPENSES500STAFF SALARIES1,000,000.00973,840.00-14,837.418,500,000.007,480,400.00-26,677.41
EMSTAFF EXPENSES513STAFF WELFARE45,159.0628,000.00-17,159.06350,000.00500,000.00-18,390.18
EMSELLING EXPENSE702BUSINESS PROMOTION89,324.7928,725.00-60,599.79259,798.33229,800.00-29,998.33
vishsaggi
Champion III
Champion III

Try this may be:

Excel1:

LOAD AutoNumberHash128(BR_CODE&TYPE)   AS %BRTYPE_KEY,

     BR_CODE,

     CATEGORY,

     NOTE_CODE,

     TYPE,

     ACT_MONTH,

     BUD_MONTH,

     VARIANCE_MONTH,

     ACT_CUMULATIVE,

     BUD_CUMULATIVE,

     VARIANCE

FROM

[..\Desktop\Book1.xlsx]

(ooxml, embedded labels, table is Sheet1);

CrossTable(Reasons, ReasonDesc, 3)

Excel2:

LOAD AutoNumberHash128(BR_CODE&TYPE) AS %BRTYPE_KEY,

     BR_CODE     AS BR,

     TYPE        AS ReasonType,

     REASON_1,

     REASON_2,

     REASON_3,

     REASON_4,

     REASON_5

FROM

[..\Desktop\Book1.xlsx]

(ooxml, embedded labels, table is Sheet2);

Then use pivot table with dim

BAR_CODE, TYPE CATEGORY

Expressions:

= Sum(ACT_CUMULATIVE)

= Sum(BUD_CUMULATIVE)

VARIANCE

= Aggr(Concat(ReasonDesc, '|'), BR_CODE, TYPE,CATEGORY)

Capture.PNG