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
MichaelHearst13
Regular Visitor

Value Filters on Orders with Multiple Lines

Hi all,

 

First post so bear with me.

 

I have a long list of approximately 80K distinct order numbers. If an order has X quantity of Item 1 and X quantity of item 2, there would be two seperate lines (and so forth). Below:

 

OrderLineItemQuantity
11Apple2
12Orange2
21Apple1
22Orange1
23Grape5
31Orange1

 

What I am ultimately trying to accomplish is to calculate two buckets, 1) the number of orders with quantities of 5 or less, and 2) the number of orders with greater than 5.

 

I've tried many different calculations, none of which work. As an example:

Small Orders = CALCULATE(DISTINCTCOUNT('2017_Orders'[Order #]),'2017_Orders'[qty_invoiced]<=5)

Large Orders = CALCULATE(DISTINCTCOUNT('2017_Orders'[Order #]),'2017_Orders'[qty_invoiced]>5)

 

So in the example above I'd want to show (on two cards): Small Orders 2 and Large Orders 1

 

Any help or guidance if this has already been addressed in another thread would be greatly appreciated.

 

Thanks!

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @MichaelHearst13,

 

Use the following measures:

 

Large Orders =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            '2017_Orders',
            '2017_Orders'[Order],
            "Qtd", SUM ( '2017_Orders'[Quantity] )
        ),
        [Qtd] > 5
    )
)
Small Orders =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            '2017_Orders',
            '2017_Orders'[Order],
            "Qtd", SUM ( '2017_Orders'[Quantity] )
        ),
        [Qtd] <= 5
    )
)

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @MichaelHearst13,

 

Use the following measures:

 

Large Orders =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            '2017_Orders',
            '2017_Orders'[Order],
            "Qtd", SUM ( '2017_Orders'[Quantity] )
        ),
        [Qtd] > 5
    )
)
Small Orders =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            '2017_Orders',
            '2017_Orders'[Order],
            "Qtd", SUM ( '2017_Orders'[Quantity] )
        ),
        [Qtd] <= 5
    )
)

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks for the clarification! Your solution worked great.

 

Best regards,

Michael

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.