Forum Discussion

abc_777's avatar
abc_777
Solution Specialist
4 years ago
Solved

hi

Hello,   I want to count customer_code where customer_code starts with "90" or "91" and if there is a value in order_ID column   I have a measure as follows please help me to find the error ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi abc_777 ,

    Try this measure 

    test =
    calculate(countrows(Sheet1),
    FILTER(sheet1,
    LEFT(Sheet1[Customer Code],2) = "90" || LEFT(Sheet1[Customer Code],2) = "91"
    ),
    FILTER(Sheet1,
    NOT(ISBLANK
    (Sheet1[Order ID])
    )
    )
    )
     

     

    Regards,

    Ashfiya

    --------------------------------------------------------------------------------------------------------------------------

    Did I help you today? Please mark my post as a solution and hit the Kudos button.

     

  • Jihwan_Kim's avatar
    4 years ago

    Hi,

    Please check the below picture and the attached pbix file, whether it suits your requirement.

     

     

    test =
    COUNTROWS (
        FILTER (
            'bm_retail_t ssummary',
            CALCULATE ( MAX ( 'bm_retail_t ssummary'[Order_ID] ) ) <> BLANK ()
                && OR (
                    LEFT ( 'bm_retail_t ssummary'[CUSTOMER_CODE], 2 ) = "90",
                    LEFT ( 'bm_retail_t ssummary'[CUSTOMER_CODE], 2 ) = "91"
                )
        )
    ) + 0