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: 
Pa1K
Contributor
Contributor

Expression for line chart

Hi...Every one.

I am new to QlikSense I would like to ask you how wen achieve the following formula in Qliksense line chart here i have attached the sample data set and required formula ....WhatsApp Image 2022-07-03 at 6.46.35 AM.jpeg

the above data related to budget and client wants a line chart with fiscal months(Apr22 to March23) on X axis and lines based on the below formula on Y Axis

Please help to do this Thank you in advance.

WhatsApp Image 2022-07-03 at 6.46.36 AM.jpeg

Labels (5)
6 Replies
sidhiq91
Specialist II
Specialist II

@Pa1K  It would be nice if you can attach the sample data in the form of excel, the attached screen shot does not help much to resolve your issue. 

Pa1K
Contributor
Contributor
Author

Dear @sidhiq91 Please find the attached Excel file

Pa1Kumar
Contributor
Contributor

Dear @sidhiq91 Could you please check ,Help me with the requirement

sidhiq91
Specialist II
Specialist II

@Pa1Kumar  Yes I am going to work on it now. You want different line chart for different formulae that you have attached above. Also,  Provide expected output in the form of line chart so that it could be easier for me to understand.

pavankumarlenka1006
Contributor
Contributor

 

Dear @sidhiq91 thank you for your time and patience.

pavankumarlenka1006_0-1657170550535.png

This is is the required form of line chart, We could do that for individual months and calculated the same, but code has become very huge,

example you can find it below for October month:

But we need the code by using some generic format either using by for-next/while which I don't understand. 

--------------------------------------------------------------------

if(F_Month='10',RangeSum(previous(CHANGE_PRICE),Previous(previous(CHANGE_PRICE)),
Previous(Previous(previous(CHANGE_PRICE))),Previous(Previous(Previous(previous(CHANGE_PRICE)))),
Previous(Previous(Previous(Previous(previous(CHANGE_PRICE))))),
Previous(Previous(Previous(Previous(Previous(previous(CHANGE_PRICE)))))))*PLN_QTY
+RangeSum(Previous(Previous(Previous(Previous(Previous(previous(PLN_QTY)))))),Previous(Previous(Previous(Previous(previous(PLN_QTY))))),
Previous(Previous(Previous(previous(PLN_QTY)))),
Previous(Previous(previous(PLN_QTY))),Previous(previous(PLN_QTY)),
previous(PLN_QTY),PLN_QTY)*CHANGE_PRICE )as OctVal,

---------------------------------------------

after calculating it for all of the months we used crosstable  as below:

----------------------------------------

MONTHVAL:
CrossTable(FMonth,MonthlyValue,7)
LOAD *,
//F_Month as PCDMonth,
AprVal,// as APRv,
Mayval,// as MAYv,
JunVal,// as JUNv ,
JulVal,// as JULv,
AugVal,// AS AUGv,
SepVal,// AS SEPv,
OctVal,// as OCTv,
NovVal,// as NOVv,
DecVal,// as DECv,
JanVal,// as JANv,
FebVal,// as FEBv,
MarVal// as MARv
resident PCDBud_Res
//Group By F_Month;
order by ModelCode,F_Year,F_Month;
drop Table PCDBud_Res;

--------------------------------------

now we could make the graph ,Please help me to simplify code using looping statement....

Thank you.

pavankumarlenka1006
Contributor
Contributor

hi @sidhiq91  hope you have got the scenario and please help me on this