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: 
Not applicable

MTD not working

Hi all,

Iam wroung some where please do let me know

I am just calculation YTD and MTD using set analysis

here is my expression

=if(Category='receivable',sum({<YEAR={'<=$(=MAX(YEAR))'},MONTH={'<=$(=MAX(MONTH))'}>} $(EXP)))

here if YTD is working fine,but not MTD ..,

please do let me know where iam wroung

Regards,

Kiruthiga

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

Yes as long as you have your data up to March 2012. If it gives you the right answer, kindly tag it as the correct answer for future references.

Regards,

Janzen

View solution in original post

22 Replies
Not applicable
Author

Hi,

May I know the value of $(EXP).

Regards,

Janzen

Not applicable
Author

HJanzen,

Thanks,

$(EXP) = if(val=5,val2,val3)---> I made that as a variable,but there is not problem in this,because,

only if I calculate YTD its working fine

Not applicable
Author

HJanzen,

Thanks,

$(EXP) = if(val=5,val2,val3)---> I made that as a variable,but there is not problem in this,because,

only if I calculate YTD its working fine

Not applicable
Author

Hi,

Can you give the expression you used for MTD? It should work using this expression.

=if(Category='receivable',sum({<YEAR={$(=MAX(YEAR))},MONTH={'<=$(=MAX(MONTH))'}>} $(EXP)))

Regards,

Janzen

Not applicable
Author

Hi,

I used the same expression

as yours which is in the starting of my post..,

is there anything do with the month alone say 1-12 after that 13,14,15..for the next year??

any idea?

because I am not getting only MTD..,

Not applicable
Author

Hi,

There is a difference between this expression compared to your earlier post. This is for MTD computation.

=if(Category='receivable',

sum({<YEAR={$(=MAX(YEAR))},

MONTH={'<=$(=MAX(MONTH))'}>}

$(EXP)))

while this one is for YTD

=if(Category='receivable',

sum({<YEAR={'<=$(=MAX(YEAR))'},

MONTH={'<=$(=MAX(MONTH))'}>}

$(EXP)))

Hope this will help

Regards,

Janzen

Not applicable
Author

Hi Janzen,

sorry in delay replying ,I tried with MTD but it is showing the exact value

means if i select feb 2011 it is giving only feb 2011 data,

but i need from jan 2010 to feb 2011 value for selecting feb 2011(Data is available from jan 2010 only)

Not applicable
Author

Hi,

Sorry I was confused with your question. What do you really need? Based on what I know MTD means from the first day of a selected month and last day of a particular month. Example if you choose Feb 2011, MTD means from Feb 1, 2011 up to Feb 28, 2011. YTD means from the first day of a selected year up to the selected day and month. Example if you choose Feb 2011, YTD means from Jan 1, 2011 up to Feb 28, 2011. May I ask for your definition of MTD and YTD?

Regards,

Janzen

Not applicable
Author

Hi Janzen,

Thanks

Sorry for confusing you,

my requirement is

if you choos Feb ,2011

if the data in database is from say  jan 2010

then it need to display data from Jan 2010 to feb ,2011

my problem is if I select only year say 2011,it is givin the sum of data(2010 + 2011 for 2011) correctly,

but if I choose the month after year selection say febafter selecting year -2011,the data is comming wroung

But YTD is enough for my scenario I think so and my expression below

if(Category='receivable',sum({$<Year={"<=$(=max(Year))"}>}$(exp))

Its very urgent ,i need to completethis by today..,there is some small mistake in my expression which iam not able to deduct..,

Hope to hear from you

Kiruthiga