Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
sakshikaul
Creator II
Creator II

to write expression using variable

Hi

I have a variable named daysOfComparison declared as follows:-

=date(lastDate)-compday

where compday is the value entered by user for comparing no. of days.

Lets say if user enters 5 as comparison no. of days input box  then the sales for 10/5/2018 will be displayed in chart as per formula mentioned above in variable

Note last date is 10/10/2018

Following is the image for above explanation

PAINT2.png

Now I want to write an expression for the same ie when user selects comparison(no. of days )=5 then sales for 10/5/2018 should be displayed

How to write an expression?

16 Replies
Anil_Babu_Samineni

If you want to show only one date of value, Try this?

Sum({<lastDate = {$(=VariableName)}>} Measure) // VariableName means - Your Input box variable


Or

Sum({<lastDate = {"=$(=Date(date(lastDate) - $(compday)))"}>} Measure)

Best Anil, 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
sakshikaul
Creator II
Creator II
Author

Hi

sum({<lastDate = {$(=DaysOfComp)}>} [inv value]

This expression is giving no result

Sum({<lastDate = {"=$(=Date(date(lastDate) - $(compday)))"}>} [inv value])

This expression is giving result but when I am entering value as comparison no. of days as 5 the corresponding date in text is being changed as 10/5/2018

but the result is not reflected in charts

Following is the image

PAINT2.png

sakshikaul
Creator II
Creator II
Author

Please help @Sunny Talwar

Anil_Babu_Samineni

Are you sure that you have created variable for comparison purpose?

Sum({<lastDate = {"=$(=Date(date(lastDate) - $(compday)))"}>} [inv value])


compday - Can you please check if The variable is same. And Can you show the same variable in Text object after entering some value whether it is changing or not?

Best Anil, 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
sakshikaul
Creator II
Creator II
Author

Hi

I have varaiable name DateOfComp labelled as

LastDate - No. Of Days

in which I have entered the value as follows :-

PAINT2.png

and comp is again a variable which has user defined value and it is used in the formula used for DateOfComp

and when expression is taken as an text box object the value is not changing for the following expression

Sum({<lastDate = {"=$(=Date(date(lastDate) - $(compday)))"}>} [inv value])

but when I enter compday=8 the corresponding value gets changed for the DateOfComp labelled as LastDate - No. Of Days

Anil_Babu_Samineni

Can you test alone in text object using below and tell me what is returning?


=Date(date(lastDate) - $(compday))

Best Anil, 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
sakshikaul
Creator II
Creator II
Author

Following I am getting in text box

PAINT2.png

sakshikaul
Creator II
Creator II
Author

Why this particular expression is giving an error?

=Sum({<sold_Date(=$(DaysOfComp))}>} [inv value])


Anil_Babu_Samineni

Can you change compday and show the same?

Best Anil, 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