Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Count

Hello Community

 

My data is as follows and i am expecting get the results as the last column (Lines Count) in bold letter

basically i would like to display how many lines are there in a perticular order using a count function in a measure

(i am trying to get this total count of order, for each line)

 

Order#

Line#

Qty

Lines Count

123

1.1

10

2

123

2.1

20

2

228

1.1

15

3

228

3.1

30

3

228

4.1

18

3

213

2.1

12

1

 

 

Using count function i am able to get the expected results, when i just take Order number column, but as soon as i add additional columns (Line#, Qty) in the table visulization, i am getting the Lines count as 1 for all lines..

 

Order#

Count of Lines

123

2

228

3

213

1

 

Appreciate your help..

 

Thanks,

 

6 Replies

  • v-yuta-msft's avatar
    v-yuta-msft
    Community Support

    Anonymous,

     

    Modify your measure like below and try again:

    Lines Count = CALCULATE(COUNT(Table1[Order#]), ALLEXCEPT(Table1, Table1[Order#]))

     

     

    Community Support Team _ Jimmy Tao

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Support team,

       

      thanks for quick turn around..

       

      I tried the below formula, it works good with lines count, but the problem is, some rows are getting duplicated, i am now getting more rows with my original data..

       

      Regards,

      • Anonymous's avatar
        Anonymous
        Not applicable

        I have a join to another table, and one of the column from 2nd table is also displayed, in such cases i am getting a duplicate row for that order..