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

how to compare this month to the previous but only for the same first days

Hello,

i have i gauge chart in which i calculate sales of this month against previous month, with this formula:

if

( GetSelectedCount (month)>0,Sum({<Shop= {'Pomax Store Wijnegem'}, Year = {$(= Max(Year))}>}LineSalesAmount) ,
Sum({<Shop= {'Pomax Store Wijnegem'},  Year = {$(= Max(Year))}, Month={$(=month(max(Date)))}>}LineSalesAmount))/
Sum({<Shop= {'Pomax Store Wijnegem'},Month=, Monthnum={$(= max (Monthnum)-1)}>}LineSalesAmount)  

but then it gives me at this momen sales of 7 days of this month against 31 days last month, which at this moment is negative.

but how do i need to do it, if i only want to compare the 7 days of this month with the total of the first 7 days of last mont?

thanx!

chris

1 Solution

Accepted Solutions
Not applicable

Because for this month you have Sales onlly of 7 days, for previous month you have Sales of 31 days

 

Try to add in these set Analysis

Day={'<$(vCurrentDay)'}

 

And add a new variabile

vCurrentDay= day(Today())

 

Ho pre this help

 

MC

View solution in original post

11 Replies
Not applicable

Because for this month you have Sales onlly of 7 days, for previous month you have Sales of 31 days

 

Try to add in these set Analysis

Day={'<$(vCurrentDay)'}

 

And add a new variabile

vCurrentDay= day(Today())

 

Ho pre this help

 

MC

chriscools
Creator II
Creator II
Author

Perfect, that worked fine!

grtz,

chris

chriscools
Creator II
Creator II
Author

Hello,

i just encountered an unwanted effect:

if i now select the previous month, i want it to give me then the maximum it can compare meaning the full month.

but instead of that it gives me something else, and i can not seem to put my finger on it what that is.

how could i solve this?

thanx!

chris

Not applicable

The change is only for second and third Sums set Analysis , not for Sum in If(getselectedcount....

Hope this helps

Regards

MC

chriscools
Creator II
Creator II
Author

Hello,

yesterday when i made it, it was ok, it showed me the first 7 days of this month compared to the first 7 days of last month.

when i look at it today, it still only gives me the first 7 days, but today it should be the first 8 days.

it feels like the "vCurrentDay= day(Today())" is not updated, can this be?

grtz,

chris

MayilVahanan

HI

Did u check once, where vCurrentDay shows today date or not?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
chriscools
Creator II
Creator II
Author

Hello,

what is the proper way to do that?

is there something to check the current value of a variable?

grtz,

chris

MayilVahanan

Hi

Put the variable name in text box and check it, whether it gives the current day or not...

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
chriscools
Creator II
Creator II
Author

then it says 8.

any reason why the calculation only goes to the 7th?

grtz