Skip to main content
Announcements
The New Qlik Learning Experience is Here! GET STARTED
cancel
Showing results for 
Search instead for 
Did you mean: 
master_student
Creator III
Creator III

variation until today()

Hello Guys,

I have a percentage that display the variation between the month of year Versus same month of year -1

The problem when the month is current month, the variation is false because it compares 5 days of current month Vs hole month of year -1


here is my expression:


=num((num(sum( {$<[Year of date]={$(=Max([Year of date]))}>} recharge_amount),'# ##0')

-num(sum( {$<[Year of date]={$(=Max([Year of date])-1)}>} recharge_amount),'# ##0'))

/ num(sum( {$<[Year of date]={$(=Max([Year of date])-1)}>} recharge_amount),'# ##0') *100,'# ## % ')


Capture.PNG

1 Solution

Accepted Solutions
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

again - as i already replied in e-mail twice:

Hi Wieme,

I think your expression should look similar to this:

=num((num(sum( {$<[Year of date]={$(=Max([Year of date]))},[YourDateField]={"<$(=Date(Today()))"}>} recharge_amount),'# ##0') // 2017

- num(sum( {$<[Year of date]={$(=Max([Year of date])-1)},[YourDateField]={"<$(=Date(AddYear(Today(),-1))"}>} recharge_amount),'# ##0')) //2016

/ num(sum( {$<[Year of date]={$(=Max([Year of date])-1)},[YourDateField]={"<$(=Date(AddYear(Today(),-1))"}>} recharge_amount),'# ##0') *100,'# ## % ') //2016

As a alternative i would create a flag in datamaodel flagging dates for YTD, where today is Today()-1 - see help document for details:

http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/DateAndTimeFunctions/ye...

regards

Lech

Best Regards,

Lech

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

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.

View solution in original post

2 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Can you elaborate your problem a little more Wiem, wasn't really clear what you're expiriencing.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

again - as i already replied in e-mail twice:

Hi Wieme,

I think your expression should look similar to this:

=num((num(sum( {$<[Year of date]={$(=Max([Year of date]))},[YourDateField]={"<$(=Date(Today()))"}>} recharge_amount),'# ##0') // 2017

- num(sum( {$<[Year of date]={$(=Max([Year of date])-1)},[YourDateField]={"<$(=Date(AddYear(Today(),-1))"}>} recharge_amount),'# ##0')) //2016

/ num(sum( {$<[Year of date]={$(=Max([Year of date])-1)},[YourDateField]={"<$(=Date(AddYear(Today(),-1))"}>} recharge_amount),'# ##0') *100,'# ## % ') //2016

As a alternative i would create a flag in datamaodel flagging dates for YTD, where today is Today()-1 - see help document for details:

http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/DateAndTimeFunctions/ye...

regards

Lech

Best Regards,

Lech

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

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.