cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rigoleto Member
Member

Create a new index column base on two columns

 

Need some DAX code to build a new Index column, as the screen shoot shown, I need use the column "NAME" and "Index' to build the new one.

 

Thanks in advance for your help

ROMPIDO.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Create a new index column base on two columns

@Rigoleto

 

Please see attached file

 

createanindex.png

7 REPLIES 7
RMDNA Senior Member
Senior Member

Re: Create a new index column base on two columns

Hi @Rigoleto,

 

What's the logic here? I don't see a pattern in the new index.

Rigoleto Member
Member

Re: Create a new index column base on two columns

Sorry,

 

Basically the logic is this, notice that the column name has two diferences descriptions, "UNIR HOMBROS" and "UNIR HOMBRO 1", and every sigle descrition has they own sub division, "AVERAGE", "GOAL" and "MAX", I need to build something like the sceenshot shown

ROMPIDO.png

Super User
Super User

Re: Create a new index column base on two columns

@Rigoleto

 

Try this technique

 

First Add another Index Column from Query Editor

 

Then may be this calculated column will do the job

 

Column =
VAR Counts =
    CALCULATE (
        COUNT ( Table1[NAME] ),
        FILTER ( Table1, [NAME] = EARLIER ( [NAME] ) )
    )
RETURN
    IF (
        Counts = 1,
        RANKX (
            FILTER (
                Table1,
                CALCULATE (
                    COUNT ( Table1[NAME] ),
                    FILTER ( Table1, [NAME] = EARLIER ( [NAME] ) )
                )
                    = 1
            ),
            [NAME],
            ,
            DESC,
            DENSE
        ),
        RANKX ( FILTER ( Table1, [NAME] = EARLIER ( [NAME] ) ), [Index],, ASC, DENSE )
    )
Super User
Super User

Re: Create a new index column base on two columns

@Rigoleto

 

Please see attached file

 

createanindex.png

Highlighted
Rigoleto Member
Member

Re: Create a new index column base on two columns

Thanks a lot for this input guys,

I did add the logic but, I getting this error, any comments about this issue?

ROMPIDO.png

Rigoleto Member
Member

Re: Create a new index column base on two columns

Sorry guys,

 

Ignore my previous post, I did have a lapsus stupidus, Smiley Happy

Community Support Team
Community Support Team

Re: Create a new index column base on two columns

Hi 

So Zubair_Muhammad's solution really helps you, right?

After testing, the solution turns out to be correct.

Could you kindly mark the answer as a solution?

 

Best Regards

Maggie

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 39 members 1,034 guests
Please welcome our newest community members: