Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

Remove Hardcoding and use variable

Hi All,

I have the below code:

load Market,

Date as [Month-Year]

    

Resident FinalTable Where Date <>'2018-09'

Instead of giving a hard coded value 2018-09 can i give in a variable.

Can you please tell me how can i do.

Thanks,

Bharat

1 Solution

Accepted Solutions
bharatkishore
Creator III
Creator III
Author

I have given like this.. guess it should work ..date(AddMonths(Today(),-1),'YYYY-MM')

View solution in original post

6 Replies
olivierrobin
Specialist III
Specialist III

hello

you can use the $() notation

let vDate='2018-09';

and in your load

where Date<>'$(vDate)'

bharatkishore
Creator III
Creator III
Author

HI Oliver,

Thanks for your reply. But next month it will be '2018-10'.. Can we write in such a way that it happens automatically for every month. Please let me know.

olivierrobin
Specialist III
Specialist III

let vDate=date(now(),'YYYY-MM')

bharatkishore
Creator III
Creator III
Author

Thanks for your reply.

But if i give this i am getting 2018-10, But in my data i have date till 2018-09 and i need to exclude that one. Sorry if i am not clear..

Please let me know if you know anything more..

bharatkishore
Creator III
Creator III
Author

I have given like this.. guess it should work ..date(AddMonths(Today(),-1),'YYYY-MM')

shwethaa
Contributor III
Contributor III

Try this-

Date(monthstart(today())-1,'yyyy-mm')