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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.