Forum Discussion

ianboothman's avatar
ianboothman
Frequent Visitor
1 year ago
Solved

Distinctcount

Good Evening 

 

I have a table relating to sales and I would like to find the voulme of unqiue sales orders.

 

My current DAX 

unique order number =DISTINCTCOUNT(Statles2[Sales Ord])
is giving a flase number. I do have a location filter panel on the page. But even with no loaction selected the unique values is still incorrect. 

Can someone please help. 

  • ianboothman Can you elaborate on why you feel the number you are getting is incorrect? That should give you a distinct count of Sales Ord. You could try replacing that with this code:

    Measure = COUNTROWS( DISTINCT( SELECTCOLUMNS( 'Table', "__SalesOrd", [Sales Ord] ) ) )

    But, again, both DISTINCTCOUNT and that measure should return the same number. 

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    ianboothman Can you elaborate on why you feel the number you are getting is incorrect? That should give you a distinct count of Sales Ord. You could try replacing that with this code:

    Measure = COUNTROWS( DISTINCT( SELECTCOLUMNS( 'Table', "__SalesOrd", [Sales Ord] ) ) )

    But, again, both DISTINCTCOUNT and that measure should return the same number. 

  • Hi ianboothman ,

    If i undertood well, you want to count only unique Sales ord (that appears only one time, with no duplicates), this can be reached by this DAX:

    Unique Sales Orders = 
    COUNTROWS(
        FILTER(
            SUMMARIZE(
                'Statles2', 
                'Statles2'[Sales Ord], 
                "Count", COUNTROWS('Statles2')
            ), 
            [Count] = 1
        )
    )
    

     

    Your result will look like this, because there's only one sales order that appears once: