Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

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

Anonymous
Not applicable
Author

Hi Punit,

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

Regards,

Ruchi

punitpopli
Specialist
Specialist

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])

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

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)
Anonymous
Not applicable
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

Anonymous
Not applicable
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
Specialist
Specialist

try using aggr function like below :

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

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

punitpopli
Specialist
Specialist

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

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

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)