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
Anonymous , I that case add an index column in power query
https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
How can i do that when it is a dax calculated table?