Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hi guys,
I have a table like the one on the left. I want to transform this table into the one on the right. Is it possible with Power Query or SQL? If so, how can I do it?
Solved! Go to Solution.
Hi @Anonymous
Do you want to have a seperate table???
Like this??
then take new table from modeling tab then write this
I hope I answered your question!
Hi @Anonymous ,
If the first and last are determined by the [Score] field, try creating a calculated table with the following code:
Table2 =
SUMMARIZE(
'Table',
'Table'[ID],
"first_CVN",
VAR __min_score = CALCULATE( MIN('Table'[Score]), ALLEXCEPT('Table','Table'[ID]) )
VAR __result = CALCULATE(MAX('Table'[Cvn]),'Table'[Score]=__min_score,ALLEXCEPT('Table','Table'[ID]))
RETURN
__result,
"last_CVN",
VAR __max_score = CALCULATE( MAX('Table'[Score]), ALLEXCEPT('Table','Table'[ID]) )
VAR __result = CALCULATE(MAX('Table'[Cvn]),'Table'[Score]=__max_score,ALLEXCEPT('Table','Table'[ID]))
RETURN
__result
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi @Anonymous ,
If the first and last are determined by the [Score] field, try creating a calculated table with the following code:
Table2 =
SUMMARIZE(
'Table',
'Table'[ID],
"first_CVN",
VAR __min_score = CALCULATE( MIN('Table'[Score]), ALLEXCEPT('Table','Table'[ID]) )
VAR __result = CALCULATE(MAX('Table'[Cvn]),'Table'[Score]=__min_score,ALLEXCEPT('Table','Table'[ID]))
RETURN
__result,
"last_CVN",
VAR __max_score = CALCULATE( MAX('Table'[Score]), ALLEXCEPT('Table','Table'[ID]) )
VAR __result = CALCULATE(MAX('Table'[Cvn]),'Table'[Score]=__max_score,ALLEXCEPT('Table','Table'[ID]))
RETURN
__result
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
hi @Anonymous
just simply take matrix visual and add two times cvn and set to first and last
I hope I naswered your question!
I was planning to create a relationship table with a matrix table, but I couldn't do it with matrix table
Hi @Anonymous
I didnt understand you query..
Relationship table with Matrix table???
That's my bad, sorry. The left table is already inserted into my report. I want to create two new columns called first_cvn and last_cvn. The first_cvn value should come from the minimum score, and the last_cvn value should come from the highest score. I am going to use this table as a join table; due to this reason, I couldn't use image solutions. 😞
Hi @Anonymous
If you want to create relationship then you need to have calculated column.
try below dax
I hope this may resolved your issue!
Hi @Anonymous
Do you want to have a seperate table???
Like this??
then take new table from modeling tab then write this
I hope I answered your question!
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 56 | |
| 42 | |
| 40 | |
| 21 | |
| 21 |
| User | Count |
|---|---|
| 149 | |
| 105 | |
| 63 | |
| 36 | |
| 36 |