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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,215,326
Messages
6,124,260
Members
449,149
Latest member
mwdbActuary

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