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
Farchurch
New Member

Power pivot second biggest value based on filter

Hi, 

 

I have a table and there i have certain products. Some of the products are interchangeable with eachother depending on the packsize. i made a key to connect the products and now it want to show in colums each avaialbe packsize for the key from highst to lowist packsize. I made this formula to find the biggest packsize in power pivot. How can i show the second biggest in a different colum? 

 

biggest value =CALCULATE(MAX([packsize]);ALLEXCEPT('table1';table1[Key]))

 

i tried to add the biggest value to the formula above in combination with < but couldnt get it to work.

 

regards Johan

1 ACCEPTED SOLUTION
Kaly
Resolver II
Resolver II

Hi @Farchurch ,

According to your description, here's my solution. Create a calculated column.

Column =
MAXX (
    FILTER (
        'Table1',
        'Table1'[Key] = EARLIER ( 'Table1'[Key] )
            && 'Table1'[Packsize] <> 'Table1'[biggest value]
    ),
    'Table1'[Packsize]
)

Get the correct result.

Kaly_0-1660207033323.png

Best Regards,

Kaly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Kaly
Resolver II
Resolver II

Hi @Farchurch ,

According to your description, here's my solution. Create a calculated column.

Column =
MAXX (
    FILTER (
        'Table1',
        'Table1'[Key] = EARLIER ( 'Table1'[Key] )
            && 'Table1'[Packsize] <> 'Table1'[biggest value]
    ),
    'Table1'[Packsize]
)

Get the correct result.

Kaly_0-1660207033323.png

Best Regards,

Kaly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Farchurch
New Member

@amitchandak 

Maby a weird question put how do i upload a pbix or table, if i drag and drop i get an error.

 

Packsizevalue 1value 2value 3value 4value 5value 6value 7KeyKey not for nowkey not for nowBiggest valuesecond biggest value
12ST1BAG12ST188802606918880STBAG18880STBAG12ST2606912STST204 
24ST2BAG12ST188802606918880STBAG18880STBAG24ST2606924STST204 
30ST1BAG30ST188803254818880STBAG18880STBAG30ST3254830STST204 
30ST2BAG15ST1888010419318880STBAG18880STBAG30ST10419330STST204 
48ST4BAG12ST188802606718880STBAG18880STBAG48ST2606748STST204 
48ST4BAG12ST188802606918880STBAG18880STBAG48ST2606948STST204 
96ST8BAG12ST188802606918880STBAG18880STBAG96ST2606996STST204 
96ST8BAG12ST1888011547918880STBAG18880STBAG96ST11547996STST204 
105ST7BAG15ST18880915518880STBAG18880STBAG105ST9155105STST204 
105ST3BAG35ST1888010419318880STBAG18880STBAG105ST104193105STST204 
204ST17BAG12ST188802606918880STBAG18880STBAG204ST26069204STST204 
204ST17BAG12ST1888011547918880STBAG18880STBAG204ST115479204STST204 
amitchandak
Super User
Super User

@Farchurch , You can create a rank and filter use visual level filter for Rank =2

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures


Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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.