Forum Discussion

awitt's avatar
awitt
Helper III
7 years ago
Solved

Sort filtered column by another column value.

How do i seperate the far right column to show the sum per order # instead of the total for both? All of the values in "Column" for Order# 10001 should be 10 and 10002 should be 12.

 

 

 

  • Anonymous's avatar
    Anonymous
    7 years ago

     

    Try this :

     

    Column = CALCULATE(SUM(Table1[Revenue]),ALL(Table1), Table1[Order#]= EARLIER(Table1[Order#]), Table1[Item Version]="S")

    Thanks
    Raj

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    What about

    Column =
    CALCULATE (
        SUM ( Sheet2[Per Item Revenue] ),
        FILTER (
            ALL ( Sheet2 ),
            Sheet2[Item Version] = "s"
                && Sheet2[Order #] = SELECTEDVALUE ( Sheet2[Order #] )
        )
    )
    • awitt's avatar
      awitt
      Helper III

      Thanks, unfortunately that just returned all blanks.

      • Anonymous's avatar
        Anonymous
        Not applicable

        What about this?

        Column =
        CALCULATE (
            SUM ( Sheet2[Per Item Revenue] ),
            FILTER (
                ALL ( Sheet2 ),
                Sheet2[Item Version] = "s"
                    && EARLIER ( Sheet2[Order #] )
            )
        )

        If that doesn't work, try removing the ALL function:

        Column =
        CALCULATE (
            SUM ( Sheet2[Per Item Revenue] ),
            FILTER ( Sheet2, Sheet2[Item Version] = "s" && EARLIER ( Sheet2[Order #] ) )
        )