Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
stighy
Contributor
Contributor

Previous Year vs Current year

Hi guys. 

I've a Table like this 

InsertDate; .....; YearWeekNumber

I want to show simply an istogram with 2 bar: for each week of the year, Count record inserted previous year vs current year.

So i wrote two new measure:

Count({<Year={"$(=Max(Year)-1)"}>} InsertDate)    // as previous year

Count({<Year={"$(=Max(Year))"}>} InsertDate)  // as current year

I've also tried using SUM instead COUNT but for both cases, i got SAME numbers...


What i wrong ?
Thanks

Labels (1)
2 Replies
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @stighy 

Always when validating set analysis statements create a table with all of the fields used in the statement, so have Year and InsertDate as dimensions and your two expressions as measures. This will then show you what values are being counted against which dimensions.

When you say you got the same numbers, is that the total for all years or the value for the same year, or something different again?

Assuming that the field Year contains an integer year and InsertDate appears on every row you want to count I can't see anything wrong with the statement. The double quotes are superfluous, as you are matching to an exact number, but they shouldn't break anything.

This blog post has a description of a prior period comparison, and a link to apps with fully working examples:

https://www.quickintelligence.co.uk/prior-period-comparison/

Hope that helps.

Steve

PrashantSangle

Can you provide us your working QVF with scramble data.

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂