Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Current vs Previous Month expression

Hi!

I have an a table like:

     

   

MonthsJan
Business GroupFTEHeadcountCurrent Month vs Previous Months
A107.31170
B5.3560
c57.82740
d49.99550

My expression is: Count(Employee)

Does anybody know how to write an expression for calculation of difference Month vs Previous month. For example February vs January?

I used an expression like: Count(Employee)- before(Count(Employee) but it shows me null when a selection of month is made.

24 Replies
Not applicable
Author

Unfortunately this doesnt work either Nobody knows how to calculate this difference?

Not applicable
Author

My first dimension is Business group, and the second one is 'Months'. I dont have MonthYear or Year or anything else

sunny_talwar

Diana‌ we all are providing you the solution based on what we think your fields, formats etc may look like. This is the best we probably can do without looking at your application.

Best,

Sunny

sasikanth
Master
Master

try some thing like below

count(${<Month={$(=max(Month))}>}employee)-count({<Month={$(=Max(Month)-1)}>}employee)

sunny_talwar

If Month is one of your dimensions then I wouldn't probably use set analysis. Above/Below function if a straight table or After/Before function if pivot table (and months are laid out horizontally) will be required. But again the ideal solution can only be provided if and when you can provide some data.

HTH

Best,

Sunny

santhoo_san
Partner - Creator II
Partner - Creator II

Create a monthend dateID use it in the set analysis expression

count({<DateID={$(=max(DateID))},Month=>}employee) - count({<DateID={$(=max(DateID)-1)},Month=>}employee)

hope this helps.

nico_ilog
Partner - Creator II
Partner - Creator II

Hi Diana,

Create 2 variables. (Ctrl + Alt + V --> Add)

vMaxMonth = Month(Max(YourDateField))

vMaxMonthPrior = Month(addmonths(Max(YourDateField),-1))

In your graph, create these expressions:

1st Exp for Selected Month =Count({<Month ={'$(vMaxMonth)'}>} Employee)

2nd Exp for Prior Month of selected = =Count({<Month ={'$(vMaxMonthPrior)'}>} Employee)

Hope this helps.

PS: Name the expressions

1 = Headcount $(vMaxMonth)

2 = Headcount $(vMaxMonthPrior)

Regards,

N

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Diana,

You will need to tweak things to match the fields you have in your model, but the app I uploaded to Qlik Community should give you a good head start on this:

QlikView App: Set Analysis - Prior Period Comparison

There are also some notes on how the app works which may be useful.

Steve

Not applicable
Author

Is your Month column just a text column with names of months or is it a Month converted Date column (like =month(Date))?

Not applicable
Author

These formulas arent working, here is my sample data attached.

Please help!