Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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!
User | Count |
---|---|
75 | |
74 | |
44 | |
31 | |
27 |
User | Count |
---|---|
99 | |
89 | |
52 | |
48 | |
46 |