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

1 Solution

Accepted Solutions
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

View solution in original post

26 Replies
nevilledhamsiri
Specialist
Specialist
Author

Will some one look in to this!.

Thanks

Neville

nevilledhamsiri
Specialist
Specialist
Author

Dear Sunny, Stefan,Anil,Oscar & the like, 

Please be kind enough to look in to this.This is very urgent! Sorry for bothering you all.

Rgds

Neville

nevilledhamsiri
Specialist
Specialist
Author

Dear Oscar,

At least will you be able to look in to this. So far no one has responded

Thanks

Neville

nevilledhamsiri
Specialist
Specialist
Author

Please help me to achieve my objective!

Simply I need to link the two table & then pick the reason from the 2nd file to be appear before the expense which has taken negative value.

Thanks

Neville

vishsaggi
Champion III
Champion III

What is your expected output out of these two tables? when you join these two there is a link formed automatically on the Field TYPE. Is it not how you see in your data model? And your expression

SUM({<BR_CODE={'RA'},TYPE={'STAFF SALARIES'}>}REASON_1) what are you trying to sum here you will always get 0 as REASON_1 has text and you are summing it.

nevilledhamsiri
Specialist
Specialist
Author

Dear Vishwarath,

Yes What You say is right. Will you help on this.

My requirement is once I loaded the 1st table which carries some expressions & once I arrive at the Variance & when it is negative what I need is to pick the suited reason from the 2nd table which carries only dimensions. Eg If I am to show you If the staff salaries are negative in variance I need to write an expression to pick reason 1  or 1 & 3 etc to be appeared against that expenses. Like wise for all expenses I need to pick from that table.

Simply show me an expression to pick a text from one table to be shown in a another table against a particular field such as what I have shown above.

Thanks

Neville

vishsaggi
Champion III
Champion III

How do you know which reason to pick? I mean what is the criteria here?

nevilledhamsiri
Specialist
Specialist
Author

Only Standard reasons were written as 1,2,3 & 4 etc. Based on the Branch, either 1st , 2nd or 3rd  reasons to be chosen. There is no direct criteria as such. If I expose my whole case which looks like below!

When the Management expenses are getting a negative variance, I need to analyze them with data such as actual , budget & variance .Thereafter to produce reasons. I thought of arranging the figures in the 1st table & standard reasons against each expenses in the 2nd table & write an expression to pick either 1st, 2nd or 1st+2nd reason etc. You may propose some other option more productive than this if available.

Just show me the possible expression to use to pick said reasons

Thanks

Neville

vishsaggi
Champion III
Champion III

Sorry My friend, i am not quite getting what you want. So let me get more understanding of this. When you have a variance negative like example

Capture.PNG

-299998,33 for this Variance what is your expected reason you are expecting ?