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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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