Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Simple Question

Hi Guys:

I have a very simple question but not able to get the answer hope that you guys can help.

In Qlikviw when we select the Year, Month and Day for sale we will be getting the transaction for that particular day. For example: - Year 2011 Month 8 and Day 8 we will get the transaction $200.

If we want the sale from 1-8 of August which is the beginning of the month to the selected day. How can I do that?

Sorry for such a simple question and hope that the solution will be simple too by the way I can not use the set analysis function.

Thanks Guys

25 Replies
Not applicable
Author

Hi Qliksus and Abhinava and Guys:

Thanks for both of your solution.

I have a small issue with the Expression that both suggestions.

My Create From Expression is:-

sum (if (invtype='40',goodqty)) + sum (if (invtype='20',goodqty))

And Crate To Expression is :-

sum (if (invtype='42',goodqty)) + sum (if (invtype='34',goodqty))

I am trying to put these expressions into the Edit script but it does not seem to be getting it correct.

So that I will be able to get CrateFrom and CrateTo in order to use the expression that you suggested.

Any idea in putting these expressions into the Edit script?

Sorry for the late reply guys…

Not applicable
Author

Hi richard,

     i believe sum() function does not work in script.. I m checking on examples how to implement ur logic.

Rgrds,

Abhinava

Not applicable
Author

Hi Abhinava:

That is what I was thinking because no matter how I try in the script with Sum function and also Sum(if) function it just won't work.

Thanks you for your reply.

Will wait for your good news

Not applicable
Author

Hi richard,

      Well gud news is that sum does work in script! you'l hv to use the "group by" clause on the field you want the sum to be calculated by....

I think you should implement the sum on front end rather than in script..

Rgrds,

Abhinava

Not applicable
Author

Hi,

Please see the attached sample may help you.

Cheers.

Not applicable
Author

Hi Abhinava and BlackRockS:

Thanks fo your reply.

If i can not inculde the sum inside the script but has to do it in the front end.

Can I use the following Expression?

Sum(if(Date<=SelDate,CrateFrom))

sum (if (invtype='40',goodqty)) + sum (if (invtype='20',goodqty))

To As follows:-

Sum(if(Year = year(CurrentDate) and Month1 = month(CurrentDate)

and [Inv. Date] <= CurrentDate, (invtype='40',goodqty)) + sum (if (invtype='20',goodqty))

It seems like there is something wrong with the following Expression...

Headach man....

Not applicable
Author

Hi,

See if this can help you.

Sum(if(Year = year(CurrentDate) and Month1 = month(CurrentDate) and [Inv. Date] <= CurrentDate and  (invtype=40 or invtype=20),goodqty))

Cheers.

Not applicable
Author

Hi Richard,

i think wht u r trying to do is this...

Sum(if((Year = year(CurrentDate)) and (Month1 = month(CurrentDate)) and ([Inv. Date] <= CurrentDate) and (invtype='40' or invtype='20'),goodqty))

Rgrds,

Abhinava

Not applicable
Author

Hi BlackRockS, Abhinava and Guys:

You all ROCKS and very helpful persons.

I never expect such a good reply from you guys… Once again you thank you guys.

The following should be written in the Expression right?

Sum(if((Year = year(CurrentDate)) and (Month1 = month(CurrentDate)) and ([Inv. Date] <= CurrentDate) and (invtype='40' or invtype='20'),goodqty))

And for the Year and Month I should write in the Edit Script right?

The following is from my script for the Year and Month.

Please comment if I got it wrong:-

LOAD

    transdate,

    Day(transdate) as Transday,

    Year(transdate) as Year,//Because of syn$

    month (transdate) as monthdes//will be in Jan,Feb, Format

    num(Month(transdate)) as month,

    num(Month (transdate)) as Month1,

    invtype,

  goodqty,

May I know how to get the Year and year and also the Month1 and month.

For the [Inv.Date] I should be using [transdate] right?

Sorry to ask so many simple questions.

Not applicable
Author

Hi Richard,

i didnt get your question...

"May I know how to get the Year and year and also the Month1 and month?"

For the [Inv.Date], you should probably use [transdate]. you should check in the source what dates fields are avalaible.

Cheers,

Abhinava

P.S- thanx for the accolades