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
Anonymous
Not applicable

Countrows measurement assistance

Hi, 

 

I am hoping someone can help me create a measurement that counts the number of orders that are shipped late. 

 

Here is my current measurement.  I know why this is not correct but cannot figure out how to count late our orders.

 

Does Not Meet SLA =
SUMX (
    VALUES ( PARTSSHIPPINGKPI_VW[CUSTOMER ORDER NUMBER] ),
    VAR vHeader = PARTSSHIPPINGKPI_VW[CUSTOMER ORDER NUMBER]
    VAR vCount =
        COUNTROWS (
            FILTER (
                PARTSSHIPPINGKPI_VW,
                PARTSSHIPPINGKPI_VW[CUSTOMER ORDER NUMBER] = vHeader
                    && PARTSSHIPPINGKPI_VW[SLA] = "Does Not Meet SLA"
                    && PARTSSHIPPINGKPI_VW[NEW ITEM] = 0
            )
        )
    RETURN
        IF ( NOT ISBLANK ( vCount ), 1 )
)
 
The table below shows an example of a customer order I do not want to count but the above measurement is currently counting.  Here are the requirements for the measurement:
  • Count the number of Customer Order Numbers that are Late
    • A "late" order will have SLA = Does Not Meet SLA
    • If one (or more) of the Customer Order Lines is late, the entire Customer Order Number is considered late. 
    • If New Item = 1 on ANY of the customer order lines do count the order as late (skip the order) 
Thanks for the help!
CUSTOMER ORDER NUMBERCUSTOMER ORDER LINESITEMNEW ITEMBUSINESS DAYSSLAMeets SLADoes Not Meet SLA
CP000224171529A414202Meets SLA1 
CP000224172529A414302Meets SLA1 
CP000224173526G4134032Does Not Meet SLA 1
CP000224174526G4135032Does Not Meet SLA 1
CP000224175526G4137032Does Not Meet SLA 1
CP000224176526G4139032Does Not Meet SLA 1
CP000224177526G4140032Does Not Meet SLA 1
CP000224178526G4133132Does Not Meet SLA  
CP000224179526G4136132Does Not Meet SLA  
CP0002241710526A2016BA032Does Not Meet SLA 1
CP0002241711A32-160020032Does Not Meet SLA 1
 
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

You can try to use the following measure formulas to get the order numbers that are shipped late based on the conditions:

formula =
VAR summary =
    SUMMARIZE (
        ALLSELECTED ( 'Table' ),
        [CUSTOMER ORDER NUMBER],
        [CUSTOMER ORDER LINES],
        [NEW ITEM],
        [SLA]
    )
VAR NewOrders =
    SUMMARIZE ( FILTER ( summary, [NEW ITEM] = 1 ), [CUSTOMER ORDER NUMBER] )
RETURN
    COUNTROWS (
        SUMMARIZE (
            FILTER (
                summary,
                NOT ( [CUSTOMER ORDER NUMBER] IN NewOrders )
                    && [SLA] = "Does Not Meet SLA"
            ),
            [CUSTOMER ORDER NUMBER]
        )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

You can try to use the following measure formulas to get the order numbers that are shipped late based on the conditions:

formula =
VAR summary =
    SUMMARIZE (
        ALLSELECTED ( 'Table' ),
        [CUSTOMER ORDER NUMBER],
        [CUSTOMER ORDER LINES],
        [NEW ITEM],
        [SLA]
    )
VAR NewOrders =
    SUMMARIZE ( FILTER ( summary, [NEW ITEM] = 1 ), [CUSTOMER ORDER NUMBER] )
RETURN
    COUNTROWS (
        SUMMARIZE (
            FILTER (
                summary,
                NOT ( [CUSTOMER ORDER NUMBER] IN NewOrders )
                    && [SLA] = "Does Not Meet SLA"
            ),
            [CUSTOMER ORDER NUMBER]
        )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.

Top Solution Authors