Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get day and month from date

Hi all,

i have a table like this

Dayvalues
2012/01/012
2012/06/013
2013/01/017
2013/06/014

if a select 2012/01/01 from a combo box i need that in a graph wiil be only the values where day and month are equals(in this case 2 and 7)

tyvm

Simone

12 Replies
Not applicable
Author

Hi Jagal,

thanks for your help.

Your solution works fine.

However I need to pass dinamically days and months in the following expressions:

Sum({<Month={1}, Day ={31}>} Measure)

or

Sum({<Month={'Jan'}, Day ={31}>} Measure)

so that assuming

month = 2

day = 24

I would have

Sum({<Month={month}, Day ={day}>} Measure)

Do you have any solution about?

i try with 2 variables vMonth vDay : Sum({<Month={vMonth}, Day ={vDay}>} values)

Regards,

Simone

jagan
Luminary Alumni
Luminary Alumni

Hi Simone,

Try like this with variables

=Sum({<Month={$(vMonth)}, Day ={$(vDay)}>} values)

Regards,

Jagan.

vishwanath
Contributor II
Contributor II

Hi Simone,

Let's assume, the name of the date column is "InventoryDate" .

So, while importing the table in the Edit Script you can use:

LOAD

       Year(InventoryDate) as InventoryYear

       Month(InventoryDate) as InventoryMonth

       Day(InventoryDate) as InventoryDay

FROM [TABLE_NAME] ;

Now, let's take a sample example of InventoryDate. Suppose, the InventoryDate is 2016-06-15,

So, by using the above load script you will get:

InventoryYear = 2016

InventoryMonth = 06

InventoryDay = 15

 

Regards,

Vishwanath Biswal