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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Uki
Frequent Visitor

how to summarize table and pick values for new columns

I know that it's basics, but having no background I could not have found a solution for my problem even though I have researched for a while.

Lets say I have a table:

link_idpipelineowner_initials
11AA
12BB
21CC
22DD
31AA
32DD


and what I want to get is a table like:

link_idSDRKAM
1AABB
2CCDD
3AADD


(SDR is owner_initials for pipeline 1, KAM is owner_initials for pipeline 2).

What is the most elegant way to do it either in M or DAX?

Thank you!
Łukasz

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Uki 
Please refer to sample file https://www.dropbox.com/t/tkYPptvUVdvfRvr1

SDR = 
CALCULATE (
        SELECTEDVALUE ( 'Pipe line'[owner_initials] ),
        'Pipe line'[pipeline] = 1
)
KAM = 
CALCULATE (
        SELECTEDVALUE ( 'Pipe line'[owner_initials] ),
        'Pipe line'[pipeline] = 2
)

1.png

View solution in original post

4 REPLIES 4
Uki
Frequent Visitor

This is what i did by myself, but I did not come up with this part:

'Table'[link_id] = EARLIER( [link_id] )

 
Reading abou EARLIER now. Not that obvious at my level 😞

tamerj1
Super User
Super User

Hi @Uki 
Please refer to sample file https://www.dropbox.com/t/tkYPptvUVdvfRvr1

SDR = 
CALCULATE (
        SELECTEDVALUE ( 'Pipe line'[owner_initials] ),
        'Pipe line'[pipeline] = 1
)
KAM = 
CALCULATE (
        SELECTEDVALUE ( 'Pipe line'[owner_initials] ),
        'Pipe line'[pipeline] = 2
)

1.png

Uki
Frequent Visitor

Thank you! Works!

VahidDM
Super User
Super User

Hi @Uki 

 

Try this code to add a new table with DAX:

 

New Table = 
ADDCOLUMNS(
    VALUES( 'Table'[link_id] ),
    "SDR",
        CALCULATE(
            MAX( 'Table'[owner_initials] ),
            FILTER(
                'Table',
                'Table'[link_id] = EARLIER( [link_id] )
                    && 'Table'[pipeline] = 1
            )
        ),
    "KAM",
        CALCULATE(
            MAX( 'Table'[owner_initials] ),
            FILTER(
                'Table',
                'Table'[link_id] = EARLIER( [link_id] )
                    && 'Table'[pipeline] = 2
            )
        )
)

 

Output:

 

VahidDM_0-1648079821324.png

 

 

 

 

Sample file attached.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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