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
kranthi82
Helper I
Helper I

Getting max value of each block and keeping the rest of the columns in the table

Hello everyone,

I am new to Power BI and have been trying to learn many things everyday. But now I feel like asking the community for some answers and hope someone can help me. Thank you in advance for everyone.

 

I got a table as shown in the picture and I want to modify the table by getting the max value of count. I want to also keep the rest of the values respectively for the other columns.

 

Block.JPG

 

I want the return table to look like this:

BlockID Count Time Column 4 Column 5

1000        1

1001        2 

1002        3

1003        1

1004        1

1005        2

 

I've tried many ways to do it and came up with wrong answers. The closest was group by but it's only returning two columns. 

 

Kranthi.

 

2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

@kranthi82 

 

Try this calculated table.

 

New Table =
FILTER (
    Table1,
    Table1[Count]
        = CALCULATE ( MAX ( Table1[Count] ), ALLEXCEPT ( TableName, TableName[BlockID] ) )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

Hi @kranthi82 

 

To modify the existing table, we can use Query Editor

Please see attached file for steps

 

Go to Query Editor>>Select Column BlockID>>>Go to Transform Tab>>Click Group BY

 

Gby.png

 

 

Now we can add a new custom column from "Add Column" tab as follows

 

=Table.Max([ALL],"Count")

Then Expand this Custom Column


Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

@kranthi82 

 

Try this calculated table.

 

New Table =
FILTER (
    Table1,
    Table1[Count]
        = CALCULATE ( MAX ( Table1[Count] ), ALLEXCEPT ( TableName, TableName[BlockID] ) )
)

Regards
Zubair

Please try my custom visuals

@Zubair_Muhammad 

 

Thanks a lot Zubair. It works perfectly fine and I got another following question. Is there any possibility to modify existing table instead of creating a new one?

Hi @kranthi82 

 

To modify the existing table, we can use Query Editor

Please see attached file for steps

 

Go to Query Editor>>Select Column BlockID>>>Go to Transform Tab>>Click Group BY

 

Gby.png

 

 

Now we can add a new custom column from "Add Column" tab as follows

 

=Table.Max([ALL],"Count")

Then Expand this Custom Column


Regards
Zubair

Please try my custom visuals

@Zubair_Muhammad 

Thank you once again. It seems to be working where as the only problem is when I apply changes, the window gets stuck after all rows is loaded as shown in the picture. What do you think the reason is and is there any other way of changing the existing table? 

 

Block fasnat.JPG

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.