Forum Discussion

menik_sun's avatar
menik_sun
Regular Visitor
5 years ago

Distinct count excluding blank rows in a matrix

Chart is like below

Contract TypeNosDesignationLocation
Permanent1Manager 1London
Permanent1Manager 1Paris
Permanent1Manager 1New York
Permanent2Manager 1Brussels
Permanent2Manager 1Amsterdam
Permanent3Worker 1Washington DC
Permanent3Worker 1London
Permanent3Worker 1Paris
Permanent3Worker 1Brussels
Contract Worker 2Amsterdam
Contract Worker 3New York
Contract Worker 4London
Contract Worker 5New York
Contract Worker 5Washington DC

 

First Formula Required: Count of Nos
Distinct Count of No excluding Blanks
for above chart, outcome should be 3 (unique count of 1, 2 & 3)

Second Formula Required: Count of Designation
Distint Count of Designation
for above chart, outcome should be 6

 

At the end, if I can get a table like below, it would be of great help:

 

Contract TypeCount of NosCount of Designation
Permanent32
Contract44
Total76

3 Replies

  • menik_sun , You can try measure like

     

    three examples

     

    calculate(distinctcount(Table[Nos]), filter(Table, not(isblank([Nos]))))

     

    calculate(distinctcount(Table[Designation]), filter(Table, not(isblank([Nos]))))

     

    calculate(distinctcount(Table[Designation]), filter(Table, not(isblank([Designation]))))

    • menik_sun's avatar
      menik_sun
      Regular Visitor

      Thanks for your reply amitchandak . It's showing correct total but not while using field dimension. It is showing total result even after using field as rows.

       

      Below is what I get after using the formula:

       

      Thanks for your reply @amitchandak . It's showing correct total but not while using field dimension. It is showing total result even after using field as rows.

       

      Below is what I get after using the formula:


                                    With suggested formula         Formula required for
      Contract Type             Count of Nos                     Count of Nos
      Permanent                           7                                          3
      Contract                              7                                          4
      Total                                    7                                          7

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi menik_sun ,

     

    Please try the following measures:

     

    first formula - COUNTROWS(SUMMARIZE(Table, Table[ContractType], Table[Desgination], Table[Nos]))

    second formula - COUNTROWS(SUMMARIZE(Table, Table[ContractType], Table[Designation]))

     

    I arrived at the following matrix using ContractType in Rows.

     

    Cheers