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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
user35131
Helper III
Helper III

is there a way using DAX to create an index for each row starting from a specific number

IDIndex
101100000
501100001
701

100002

801100003
901100004
1001100005
1101100006
1201100007
1301100008

 

My normal code

 

ADDCOLUMNS(ID,"Index" ,RANKX(ID,[ID],,ASC,Dense))
 
gives me
 
IDIndex
1011
5012
701

3

8014
9015
10016
11017
12018
13019

 

I would like to keep the same idea but is there a function like Start on(100000) and the index counts from the specific number.

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @user35131 

Thanks for reaching out to us.

>> My normal code   ADDCOLUMNS(ID,"Index" ,RANKX(ID,[ID],,ASC,Dense))

Actually you are very close to the correct answer.

You can try this DAX expression,

t1 = ADDCOLUMNS('Table',"Index" ,RANKX('Table',[ID],,ASC,Dense),"test",100000+RANKX('Table',[ID],,ASC,Dense))

vxiaotang_0-1659602927231.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @user35131 

Thanks for reaching out to us.

>> My normal code   ADDCOLUMNS(ID,"Index" ,RANKX(ID,[ID],,ASC,Dense))

Actually you are very close to the correct answer.

You can try this DAX expression,

t1 = ADDCOLUMNS('Table',"Index" ,RANKX('Table',[ID],,ASC,Dense),"test",100000+RANKX('Table',[ID],,ASC,Dense))

vxiaotang_0-1659602927231.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

johncolley
Solution Sage
Solution Sage

Hi @user35131 , 2 options:

DAX: add +99999 at the end of your code

Power Query: Add an Index Column - there is an option to start at custom number:

johncolley_0-1657673304141.png

If this answer solves your problem please mark it as a solution!

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.