Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Calculate customers visits frequency

Hi there,

 

I'm new to the forum and DAX and I need some help.

Generally, the problem is that I have a table with 2 fields, Dates and Customers. What do I want to get is a chart showing how many customers are visited 1 time, how many 2 times and etc. Link to the data is here: CustomersVisitsData

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thank you in advance.

4 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Icon for Community Champion rankCommunity Champion

    Anonymous

     

    If you already have a Count of Visits Column in your Raw Data

     

    you can simply put it in the X - Axis and put the count of count of Visits as Values

     

    Please see the attached file

     

    If you dont have this column, you can use this calculated column

     

    Count of Visits =
    IF (
        [DATE_OF_VISIT]
            = MINX (
                FILTER ( Table1, [Customer Name] = EARLIER ( [Customer Name] ) ),
                [DATE_OF_VISIT]
            ),
        CALCULATE (
            COUNT ( Table1[DATE_OF_VISIT] ),
            ALLEXCEPT ( Table1, Table1[Customer Name] )
        )
    )