Forum Discussion
Index based on two date columns
- 4 years ago
This is done more easily in the query editor, but since you stated you need a DAX column, this one seems to work. You'll need to replace Index with your actual table name.
NewIndex =
VAR vThisValue =
INT ( CONVERT ( Index[Purchase date], DATETIME ) )
+ INT ( CONVERT ( Index[sales date], DATETIME ) ) / 100000
VAR vAdd =
ADDCOLUMNS (
Index,
"cValue",
INT ( CONVERT ( Index[Purchase date], DATETIME ) )
+ INT ( CONVERT ( Index[sales date], DATETIME ) ) / 100000
)
RETURN
RANKX ( vAdd, [cValue], vThisValue, ASC )Note that I needed to use several Replace Values steps in the query editor to change month names to my locale (e.g., oktober, marts, februrary).
Pat
This is done more easily in the query editor, but since you stated you need a DAX column, this one seems to work. You'll need to replace Index with your actual table name.
NewIndex =
VAR vThisValue =
INT ( CONVERT ( Index[Purchase date], DATETIME ) )
+ INT ( CONVERT ( Index[sales date], DATETIME ) ) / 100000
VAR vAdd =
ADDCOLUMNS (
Index,
"cValue",
INT ( CONVERT ( Index[Purchase date], DATETIME ) )
+ INT ( CONVERT ( Index[sales date], DATETIME ) ) / 100000
)
RETURN
RANKX ( vAdd, [cValue], vThisValue, ASC )
Note that I needed to use several Replace Values steps in the query editor to change month names to my locale (e.g., oktober, marts, februrary).
Pat
Thank you so much, your solution worked!