Forum Discussion

sdhn's avatar
sdhn
Responsive Resident
4 years ago

Getting one extra count.

Hello All,

 

I have a measure as

 

OpenNMSCounts = COUNTROWS(ALLSELECTED(Source)) -1
 
I am getting one extra count. 
For eg:
 
Totals Rows are "30" but its dispalys as: "31".  Any help will be appreciated.  Thanks 

10 Replies

  • Hi sdhn 

     

    Try this:

    OpenNMSCounts = Distinct(ALLSELECTED(Source)) 

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudos!!
    LinkedIn: 
    www.linkedin.com/in/vahid-dm/

     

     

    • sdhn's avatar
      sdhn
      Responsive Resident

      Did not work out.  Error 

       

      screen grayed out 

  • sdhn's avatar
    sdhn
    Responsive Resident

    Getting error:

     

    "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."

    • VahidDM's avatar
      VahidDM
      Super User

      Hi sdhn 

       

      Try to add a column from your table to the formula:

      OpenNMSCounts = Distinct(ALLSELECTED(Source[Column])) 

       

      If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
      Appreciate your Kudos!!
      LinkedIn: 
      www.linkedin.com/in/vahid-dm/

       

       

      • sdhn's avatar
        sdhn
        Responsive Resident

        It was my mistake. I rephrase my question. 

         

        I have merged multiple files onto one file during transformation & load. New file is called Source.
        Source. Name column has all files name. This column has created by load process. 
         
         
        Below  measure is counting one extra row.  I want exact rows.

         

        we are using following measure to get total counts of each types or files.

         

        Source = CALCULATE(COUNT(Source[Source.Name]), ALLEXCEPT(Source,Source[Source.Name]))