Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
ruchibagaria
Creator
Creator

How to show previous month data in current month?

Hi All,

With month as dimension, I want to show previous month data in each month. If I use variable, it shows in two lines. I need to see in one line. Please advice.

Regards,

Ruchi

Message was edited by: Ruchi Bagaria

10 Replies
punitpopli
Creator III
Creator III

Can you please share an example what you are trying to achieve and would be great if you can add a sample QVW file

ruchibagaria
Creator
Creator
Author

Hi Punit,

I have attached a sample app with sample source data. And thanks for the response.

Regards,

Ruchi

punitpopli
Creator III
Creator III

two line, do you mean in two different columns?

and you need it to have both Previous month stock and Current month stock in a single column?

Anil_Babu_Samineni

May be use this for Previous Month for your Pivot Object

=sum({<MonthYear = {"$(=Date(Max(MonthYear-1),'MMM-YYYY'))"}>}[Total Stock])


Or By using Variable you may try this


=sum({<MonthYear = {"$(=vPrevMthNo)"} >}[Total Stock])

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
ruchibagaria
Creator
Creator
Author

Hi Anil,

I had tried both. The problem is, the sata comes in two rows. I want it be in a single row.

Regards,

Ruchi

ruchibagaria
Creator
Creator
Author

Hi Friends,

I could solve it. I just had to take the Price from Dimension as put it as a measure and it worked. Hence, closing the discussion. Thanks for your responses.

Regards,

Ruchi

punitpopli
Creator III
Creator III

try using aggr function like below :

=aggr(sum({<MonthYear={'$(vPrevMthNo)'}>}[Total Stock]),[Planning Article])

=Aggr( sum([Total Stock]),[Planning Article])

punitpopli
Creator III
Creator III

Hi ruchibagaria

Please mark response from above as helpful/correct answer to closed the thread

Thanks

Anil_Babu_Samineni

What do you meant by single row here, can you describe more your intend to look

I got like below, What was the expect from here

Capture.PNG

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)