locked
Distinct Count RRS feed

  • Question

  • I have a data model with 2 tables, the data table and the calendar table. There is a calculated field that counts the customers by year using the distinct count and everything works perfect. Now I need to know which are returning and which are new customers. Can someone please guide me how can I create the necessary DAX expression to accomplish my requirements. Thanks for your help!
    Monday, January 18, 2016 2:45 PM

Answers

  • Expression from article above.

    Returning customers :=
    COUNTROWS (
        CALCULATETABLE (
            VALUES ( Sales[Customer] );
            VALUES ( Sales[Customer] );
            FILTER ( ALL ( Calendar ); Calendar[Date] < MIN ( Calendar[Date] ) )
        )
    )
    • Edited by Tomas Ludvik Tuesday, January 19, 2016 9:35 AM
    • Marked as answer by Otto Knoke Tuesday, January 19, 2016 8:49 PM
    Tuesday, January 19, 2016 9:35 AM

All replies

  • Yes.

    Check out the <a href="http://PowerBIPhilly.org">Power BI User Group of Philadelphia.</a>
    Our next meeting is February 2 in Malvern, PA.

    Monday, January 18, 2016 3:28 PM
  • Expression from article above.

    Returning customers :=
    COUNTROWS (
        CALCULATETABLE (
            VALUES ( Sales[Customer] );
            VALUES ( Sales[Customer] );
            FILTER ( ALL ( Calendar ); Calendar[Date] < MIN ( Calendar[Date] ) )
        )
    )
    • Edited by Tomas Ludvik Tuesday, January 19, 2016 9:35 AM
    • Marked as answer by Otto Knoke Tuesday, January 19, 2016 8:49 PM
    Tuesday, January 19, 2016 9:35 AM