Adding a Sequential number column in DAX

hatstand

Well-known Member
Joined
Mar 17, 2005
Messages
778
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

The following code creates a table, based on a table with a column of dates. What I can't figure out is how to add an Index column, so it can then be used to order the Visual Date column. I can't use RANKX as it creates sequential column, but based on dates. Any ideas or pointers would be very much appreciated as I'm totally stuck. Thanks.

Dynamic Date Selections =
UNION(
ADDCOLUMNS(CALENDAR(MIN('Calendar'[Date]),MAX('Calendar'[Date])),
"Visual Date", UPPER(FORMAT([Date],"mmm")) & " " & RIGHT(
IF(MONTH([Date]) >= 4, FORMAT(YEAR([Date]), "00"), FORMAT(YEAR([Date])-1, "00")),2) & "/" & RIGHT(IF(MONTH([Date]) >= 4, FORMAT(YEAR([Date]), "00"), FORMAT(YEAR([Date])-1, "00")),2)+1,
"Type", "Reporting Month Year",
"Order", 1),
ADDCOLUMNS(CALENDAR(MIN('Calendar'[Date]),MAX('Calendar'[Date])),
"Visual Date", if( MONTH([Date]) >=4, YEAR([Date]), YEAR([Date])-1) & "-" &if( MONTH([Date]) >=4, YEAR([Date]), YEAR([Date])-1)+1,
"Type", "Reporting Year",
"Order", 2
))
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Pleas ignore the above question. The reason is that even when adding an index column. It cannot be used to order the Visual Date Column as there are duplicate entries.
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,594
Members
452,655
Latest member
goranzoric

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top