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
Henrik_99
Resolver I
Resolver I

Index Calculated columns

Hi

I need to  add the calculated index column to the table by a DAX formula. 

 

Untitled.GIF

 

Rgds

Henrik

1 ACCEPTED SOLUTION

Hi @Henrik_99,

It seems like a multiple column sort recruitment, maybe you can take a look at following thread about using isonorafter to sort multiple columns:

Sorting by multiple columns 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

7 REPLIES 7
Henrik_99
Resolver I
Resolver I

Hi all, thanks for reply!!

 

I`ll try to clarify. This figure might help. 6121/TEST-LINE-1 is the "mother" of "6121/ST-TESTPIPE" with "children-ID`S.

 

It`s all about to get Test-Line-1 in first row and ST-TestPipe in second row with children ids etc..

 

If you have a solution that would be great. Thanks.

 

Capture.GIF

 

Hi @Henrik_99,

It seems like a multiple column sort recruitment, maybe you can take a look at following thread about using isonorafter to sort multiple columns:

Sorting by multiple columns 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

Basis what do you want to create the Index column - the first 4 characters of the Key column?  Clarify.


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

Seems like a variation of Cthulhu - https://community.powerbi.com/t5/Quick-Measures-Gallery/Cthulhu/td-p/509739


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
FrankAT
Community Champion
Community Champion

Hi @Henrik_99 

I think you have to do it with Power Query like this:

// Table
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pdM9DoAgDAXguzBrLC0qjEY8AWzGG3j/2Z9oECbiSxgK6fdoQlhX5VhTF5cQVaO+i2n2YkSrrcmb7noi/ZbXcbsXjvt6l3acRQx4xIhHWDzCwRFC+BTmE1G8tSEfWDTnHc8NnDJLIBUgjSOZNYDtATsAdgSsBaz7b5kAe37+7QA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t, D = _t, E = _t, KEY = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type text}, {"B", type text}, {"C", type text}, {"D", type text}, {"E", type text}, {"KEY", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"A"}, {{"Gruppieren", each _, type table [A=text, B=text, C=text, D=text, E=text, KEY=text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Index", each Table.AddIndexColumn([Gruppieren], "Index", 1, 1)),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Index"}),
    #"Expanded {0}" = Table.ExpandTableColumn(#"Removed Other Columns", "Index", {"A", "B", "C", "D", "E", "KEY", "Index"}, {"A", "B", "C", "D", "E", "KEY", "Index.1"})
in
    #"Expanded {0}"

21-03-_2020_17-16-18.png

 

Regards FrankAT

az38
Community Champion
Community Champion

Hi @Henrik_99 

Try a column

Index = 
RANKX (
FILTER('Table','Table'[A] = EARLIER('Table'[A])),
'Table'[KEY]
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

it works perfectly. Thanks.

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.