Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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_id | pipeline | owner_initials |
1 | 1 | AA |
1 | 2 | BB |
2 | 1 | CC |
2 | 2 | DD |
3 | 1 | AA |
3 | 2 | DD |
and what I want to get is a table like:
link_id | SDR | KAM |
1 | AA | BB |
2 | CC | DD |
3 | AA | DD |
(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
Solved! Go to Solution.
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
)
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 😞
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
)
Thank you! Works!
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:
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/
User | Count |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
21 | |
11 | |
10 | |
10 | |
8 |