Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sravani5
Contributor
Contributor

How to subtract current month values with previous month values in straight table with dimension is year and columns as months

Hi,

Can someone help me to solve the below.

I have a straight table which has year as dimension and columns as months. I am trying to calculate variance (current month - previous month) but, facing issues when I am trying to subtract Jan month with dec month values.

Calculation has to be done at row level as per the screenshot and attachments below.

Sravani5_0-1688469432291.png

 

Thank you.

Labels (1)
2 Replies
udit_k
Partner - Creator II
Partner - Creator II

Current month :-

sum({<Year={'$(=year(addyears(yearstart(max([Start Date])),0)))'},Month={'>=$(=month(yearstart(max([Start Date]))))<=$(=month(Max([Start Date])))'},Month=>}value)

 

Previous month:-

sum({<Year={'$(=year(addyears(yearstart(max([Start Date])),-1)))'},Month={'>=$(=month(yearstart(max([Start Date]))))<=$(=month(Max([Start Date])))'},Month=>}value)

 

Sub:-Column(1)-Column(2)

udit_k_0-1688475182608.png

 

Sravani5
Contributor
Contributor
Author

Thanks for your reply..

My requirement has only month columns and we need to calculate only variance among them.