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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Sixian
Frequent Visitor

How to create a view with the largest three values for each row

I'm struggling with a couple of problems in the same project and I'll post two different help request.

You can find the Problem 1 in this post: https://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-filter-a-page-with-different-attribute...

 

Problem 2.

I have a table with more than 80 Attributes, like this:

ScreenShot 041.jpg

I want to create a page with a view that shows the largest three attributes for each name, like this:

ScreenShot 045.jpg

 

I would really appreciate any help.

Thank you

4 REPLIES 4
Sixian
Frequent Visitor

I still can't find a way to unpivot my Attributes Table.

I can't do it in power query, because it is a calculated table, created using the following DAX code:

AttributesTable =
var filteredTable = FILTER('InputTable', 'InputTable'[Exclude] = "NO")
return SELECTCOLUMNS(filteredTable,
"Name", 'InputTable'[Name]
)

 

Then, all the more than 80 attributes have been added as calculated columns using DAX code.

Please, any help?

Thank you

wdx223_Daniel
Super User
Super User

think you can use generate instead of addcolumns

wdx223_Daniel
Super User
Super User

firstly, you need to unpivot your data like this

wdx223_Daniel_0-1611219366704.png

then add a dimension table like this

wdx223_Daniel_1-1611219395734.png

then create two measures

Attr = CALCULATE(MAX('Table'[Attribute]),FILTER(VALUES('Table'[Attribute]),RANKX(ALL('Table'[Attribute]),CALCULATE(MAX('Table'[Value])))=MAX('TopN'[Index])))
Val = CALCULATE(MAX('Table'[Value]),FILTER(VALUES('Table'[Attribute]),RANKX(ALL('Table'[Attribute]),CALCULATE(MAX('Table'[Value])))=MAX('TopN'[Index])))

then show the view you want 

wdx223_Daniel_2-1611219497851.png

 

My Data Table is a calculated table where I added all the Attributes columns using formulas. How can I unpivot the table?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors