Forum Discussion

adriansuteu's avatar
adriansuteu
Advocate I
9 years ago
Solved

Count and Countrows returning the wrong figure

Hi.

 

I have a table that contains ~2900 rows with columns. You can see it in the screenshot below.

 

I am trying to count the orders (each order has a row in this table) and create visualizations based on the figures.

 

The problem is that the formulas return strange values:

Measure = countrows('Orders') returns 50

Measure = count('Orders'['Count']) returns 50 (after creating the column Count=1)

Measure = calculate(countrows('Initial Orders'),all('initial orders'))  returns the right number, but then if I add Axis (categories of products) I get the same figure for each value.

 

Please help me figure this out.

 

Thanks.

 

  • Hi.

     

    I solved the problem.

    I guess it was some kind of bug.

     

    All I did was to copy the source data (the whole table as it is), from a multiple sheet xlsx to a csv file and then use that file as source. And now everything works fine, COUNT, COUNTA and COUNTROWS.

     

    Thanks for your interest!

6 Replies

    • Jollyjolie's avatar
      Jollyjolie
      New Member

      hello,

       

      I am experiencing the same issue. CountA, CountAX, Countrows retutning the wrong count of numbers in my pbix file. Do I have to separate the source files as the result is an error

  • Anonymous's avatar
    Anonymous
    Not applicable

    I faced the same issue.

     

    I have country names in a column and I need to count the number of times they appear.

     

    I used the following DAX to count the number of times they appear in the table -:

     

    Matches Won = COUNT('Cricket Data'[Winner])
     
    But, it gave me a terrible result when I put it against the country names. It actually gave me the number of times they appear in "Country" column rather than giving it from the "Winner" column.
     
    I think its a bug.
     
    Please fix this ASAP.
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi adriansuteu,

     

    Can you share the sample file to test? I can't find the columns which you used in the formula.

    In addition, can you provide some detail content of your opertions? It will be help for troubleshooting.

     

    Regards,
    Xiaoxin Sheng

    • adriansuteu's avatar
      adriansuteu
      Advocate I

      Hi.

       

      I solved the problem.

      I guess it was some kind of bug.

       

      All I did was to copy the source data (the whole table as it is), from a multiple sheet xlsx to a csv file and then use that file as source. And now everything works fine, COUNT, COUNTA and COUNTROWS.

       

      Thanks for your interest!

      • Anonymous's avatar
        Anonymous
        Not applicable
        Even if I run the same formula by changing the data source to csv... The error remains as it was before...