Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

count rows

Dear Friends

i have table with thousands of rows as shown:

 i need to count the number of "MR Number" wherer MR number contains only Status = "Initial", for example in above MR 1322398 & 1321621 have only status ="Initial", so that MR number Count=2

how can i do this by dax measure for all rows

 

Thanks

  • Anonymous , Try a new measure like

     


    countx(filter(summarize(Table, Table[MR Number], "_cnt", count(Table[MR Number]), "_init", countx(filter(Table, Table[Status] = "Initial"),Table[MR Number])), [_cnt] =[_init]),[MR Number])

6 Replies

  • Anonymous , Try a new measure like

     


    countx(filter(summarize(Table, Table[MR Number], "_cnt", count(Table[MR Number]), "_init", countx(filter(Table, Table[Status] = "Initial"),Table[MR Number])), [_cnt] =[_init]),[MR Number])

  • HI Anonymous ,

     

    You can simply create a measure:

     

    newCacl =
    CALCULATE (
        DISTINCTCOUNT ( yourTablname[MR Number] ),
        yourTablname[Status] = "INITIAL"
    )
    

     

    In the above DAX just replace with your table name and column names.

     

    Thanks,

    Pragati

      • Pragati11's avatar
        Pragati11
        Super User

        Hi smpa01 ,

         

        I think you updated you response from the initial one. This will definitely work.

         

        Thanks,

        Pragati

  • a=Calculate(count([MR Number]),Filter(TableName,TableName[Status] = "Initial"))

  • smpa01's avatar
    smpa01
    Community Champion

    Anonymous 

    Measure =
    CALCULATE (
        COUNT ( tbl[Status] ),
        FILTER ( VALUES ( tbl[Status] ), tbl[Status] = "INITIAL" )
    )