Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Measure

Hi there,   I have 2 columns of data; Product & Minimum order quantity. However sometimes I can have mission data in column #3 and I want to be able to count those value of a product that are eithe...
  • amitchandak's avatar
    6 years ago

    Anonymous , Create a new colum

    column =
    var _cnt_0 = countx(filter(table,[Product] =earlier([Product]) && [Qty]=0),[Product])
    var _cnt = countx(filter(table,[Product] =earlier([Product]),[Product])
    return 
    if(_cnt_0 = 0 || _cnt =0,"Uniform","Non Uniform")
  • v-xicai's avatar
    6 years ago

    Hi Anonymous ,

     

    You may create measure like DAX below.

     

     

    Measure1 =
    VAR _CountAll =
        COUNTROWS ( FILTER ( Table1, Table1[Product] = MAX ( Table1[Product] ) ) )
    VAR _CountZero =
        COUNTROWS (
            FILTER (
                Table1,
                Table1[Product] = MAX ( Table1[Product] )
                    && Table1[quantity] = 0
            )
        )
    VAR _CountNoZero =
        COUNTROWS (
            FILTER (
                Table1,
                Table1[Product] = MAX ( Table1[Product] )
                    && Table1[quantity] <> 0
            )
        )
    RETURN
        IF (
            _CountZero = _CountAll
                || _CountNoZero = _CountAll,
            "Uniformly",
            "Not Uniformly"
        )
    

     

    Best Regards,

    Amy 

     

    Community Support Team _ Amy

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.