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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
awitt
Helper III
Helper III

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.

 

image.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

 

Try this :

 

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

Thanks
Raj

View solution in original post

10 REPLIES 10
Anonymous
Not applicable

What about

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

Thanks, unfortunately that just returned all blanks.

image.png

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 #] ) )
)

 

 

That's what I had. 😕

 

image.png

Anonymous
Not applicable

Ok, try removing the ALL function. I had an alternate formula in my last post (I added it as an edit), see if that works.

Still getting the total revenue for all "s" revenue instead of it sorting by Order #. 

Anonymous
Not applicable

 

Try this :

 

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

Thanks
Raj

Awesome, thanks!

Anonymous
Not applicable

Got it (I think):

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

Good job @Anonymous , Your logic was right, just syntax needed some correction.

 

Thanks

Raj

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.