Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Graph help - MTD vs. YTD

Hello,

I have tried to read multiple discussion threads and I cannot seem to convert the information into what is needed.  I am looking to create a graph that shows 3 years of monthly trends, and the current year's YTD trend.  So far I have only been able to create the monthly trends.  Here is what I am using so far

Dimensions - Month and then Year

Expressions - Sum(2015 losses)/sum(2015 premiums)

Sum(2014 losses)/sum(2014 premiums)

Sum(Plan Losses)/sum(plan premiums)

What I am trying to use for YTD incorrectly -

=(Sum ({<[MONTH-NUMERIC] = {"<=$(=max({<YEAR={$(=max(YEAR))}>} [MONTH-NUMERIC]))"}, YEAR={'2015'}>}losses)/

Sum ({< [MONTH-NUMERIC] = {"<=$(=max({<YEAR={$(=max(YEAR))}>} [MONTH-NUMERIC]))"}, YEAR={'2015'}>}[premium))

At this point my data is in Month, Year, and I have a date field I am not using currently of YYYY/MMM.  I have read in several articles about a master calendar but I am not sure how to implement with just using month and year.  Looking for some help in the right direction to complete the graph properly.  Shown below is the graph so far, with both YTD 2015 and MTD 2015 on top of each other.

sales graph.png

12 Replies
Anonymous
Not applicable
Author

Amar,

Thank you for the help.  Would I be able to use Set analysis for the If statements?  Or just use one if statement for the dimension?  Just wondering if there was a way to do it with less if statements.

Thanks again,

Justin

Anonymous
Not applicable
Author

Actually with set analysis we wouldn't be able to compare to fields that's why I replaced it with sum if statements but if you have too many conditions I would normally create a flag in the script and use it in the expressions i.e.

- if ([CAT IND]='N' and [NEW RENEW IND]='NEW' ,1,0) as Flag_Condition1

sum(Value*Flag_Condition1)

I  would keep the expression as simple as possible and handle all the complexity in the backend as much as possible.

Thanks,

Anonymous
Not applicable
Author

Amar,

That is helpful to know.  Thank you so much for the help with this.  I will give that a try with the flag to see how it works out.  Seems easy and helpful.  Could I do something similar for the plan years I have?  Having a text with all numbers seems to have given me problems so far.

Thanks again,

Justin