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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Rigolleto
Resolver I
Resolver I

Add a sequence number to a list of values

HI,

 

I need help to create a sequence number as the photo shows,  notice that I have the color duplicate, that is correct, every color belong to a different Style, I need a DAX code to built the sequence and used it later in a calculation 

 

Thanks

 

 

ImageForo.PNG

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, create an Index number column from 1.  Thereafter, write this calculated column formula

=CALCULATE(DISTINCTCOUNT(Data[Attribute]),FILTER(Data,Data[Index]<=EARLIER(Data[Index])))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, create an Index number column from 1.  Thereafter, write this calculated column formula

=CALCULATE(DISTINCTCOUNT(Data[Attribute]),FILTER(Data,Data[Index]<=EARLIER(Data[Index])))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
TomMartens
Super User
Super User

Hey,

 

I'm not sure if I understand your requirement 100%, but maybe this is what you are looking for.

 

Create a calculated column using this DAX (not complete):

<nameofthecalculatedcolumn> = 
var thisAttribute = '<yourtablename>'[Attribute]
return
SWITCH(
   thisAttribute
    ,"FRISALES", 1
    ,"MONSALES", 2
    ,...
)

Hopefully, this is what you are looking for.

 

If not please create a pbix that contains sample data that represents your table structure, upload the pbix to onedrive or dropbox and share the link.

 

Regards,
tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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