Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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

  • Hi Anonymous ,

    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.

    Best Regards,

    Kaly

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

3 Replies

  • Kaly's avatar
    Kaly
    Icon for Resolver II rankResolver II

    Hi Anonymous ,

    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.

    Best Regards,

    Kaly

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    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