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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Changing Data Format

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?



Yushiyima_0-1718170599759.png

 

2 ACCEPTED SOLUTIONS

Hi @Anonymous 

 

Do you want to have a seperate table??? 

 

Like this??

Uzi2019_0-1718176150146.png
then take new table from modeling tab then write this 

Uzi2019_2-1718176300693.png

 



Summarize table = SUMMARIZE(Table3,Table3[RN],
"Min CNV",CALCULATE(MIN(Table3[CVN]),ALLEXCEPT(Table3, Table3[RN])),
"Max CNV",CALCULATE(Max(Table3[CVN]),ALLEXCEPT(Table3, Table3[RN])))
 

 

Uzi2019_1-1718176273602.png

 

 

I hope I answered your question!

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

View solution in original post

Anonymous
Not applicable

Hi @Anonymous ,

If the first and last are determined by the [Score] field, try creating a calculated table with the following code:

vcgaomsft_0-1719208981197.png

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
)

vcgaomsft_1-1719209109868.png

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

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @Anonymous ,

If the first and last are determined by the [Score] field, try creating a calculated table with the following code:

vcgaomsft_0-1719208981197.png

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
)

vcgaomsft_1-1719209109868.png

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

Uzi2019
Super User
Super User

hi @Anonymous 

 

just simply take matrix visual and add two times cvn and set to first and last

Uzi2019_1-1718171381286.png

 

 

Uzi2019_0-1718171341275.png

I hope I naswered your question!

 

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Anonymous
Not applicable

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???



Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Anonymous
Not applicable

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 

 

Min CVN = CALCULATE(MIN(Table3[CVN]),ALLEXCEPT(Table3, Table3[RN]))

max CVN = CALCULATE(MAX(Table3[CVN]), ALLEXCEPT(Table3, Table3[RN]))

Uzi2019_0-1718175625342.png

 

 

I hope this may resolved your issue!

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Hi @Anonymous 

 

Do you want to have a seperate table??? 

 

Like this??

Uzi2019_0-1718176150146.png
then take new table from modeling tab then write this 

Uzi2019_2-1718176300693.png

 



Summarize table = SUMMARIZE(Table3,Table3[RN],
"Min CNV",CALCULATE(MIN(Table3[CVN]),ALLEXCEPT(Table3, Table3[RN])),
"Max CNV",CALCULATE(Max(Table3[CVN]),ALLEXCEPT(Table3, Table3[RN])))
 

 

Uzi2019_1-1718176273602.png

 

 

I hope I answered your question!

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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