Forum Discussion

DemoFour's avatar
DemoFour
Icon for Continued Contributor rankContinued Contributor
5 years ago
Solved

Count of returning client

Hi All, 

 

I am trying to count up client ID's when they have returned and received another application number. 

 

The problem I have is that each application is taken through a series of events so that each application has many and varying rows. 

 

Sample data is as follows

 

DateCleint IDApplication NumberSequence StageStaff MemeberCount of Applications (Desired Outcome)
01.01.21   111200A2
01.01.21   112300A2
01.01.21   113900A2
01.01.21   221200B2
01.01.21   222300B2
01.01.21  331200C1
01.02.21   141200C2
01.02.21   451200A1
01.02.21   452300A1
01.02.21  261200C2
01.03.21 571200A1

 


The desired output is to have the number of returning clients in a card as a number, so that a slicer of staff names changes the card. I also want to put this info into a table / matrix to show the dates and returning customers with staff name. 

I hope this makes sense, it seamed easy when I started but I am a bit foxed by not being able to do this - in respsect that I get the wrong number returned due to counting the all the client ID's for each interaction! 

Thanks for any help

  • DemoFour 

    Try:

    Number of applicacions by Client ID = 

     

    Number of applicacions by Client ID = CALCULATE(
                                            DISTINCTCOUNT(Table[Application Number],
                                            ALLEXCEPT(Table, FactTable[Cleint ID]))
    

     

     

     

6 Replies

    • DemoFour's avatar
      DemoFour
      Icon for Continued Contributor rankContinued Contributor

      amitchandak 

       

      The definition of returning customer is that they have a new application number. 

      What I am trying to achive is a count of the number of application numbers for each client. 

      For example 

      Duplicate = 
      VAR Client = 'Application Status Change'[Client Number]
      VAR Result =
      COUNTROWS(
          FILTER( 'Application Status Change',
          AND(
              Client = 'Application Status Change'[Client Number] , 'Application Status Change'[Application Status Code] = 200
          )
      )
      )
      RETURN
      Result    


       This code works for the count if the application is added at 200 however we have other options (too many to code up this way) so I am looking to count each distinct application for each client (client ID) to see how many times they have had an application. 

      Also some new applications are opened before previous ones are closed by different members of staff, so I want this to be flagged up as this needs to stop happening. 

      Thank you for the links, I have read the posts and got some ideas for other things I need, but not the question I am asking. 

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

    DemoFour 

    Try:

    Number of applicacions by Client ID = 

     

    Number of applicacions by Client ID = CALCULATE(
                                            DISTINCTCOUNT(Table[Application Number],
                                            ALLEXCEPT(Table, FactTable[Cleint ID]))
    

     

     

     

    • DemoFour's avatar
      DemoFour
      Icon for Continued Contributor rankContinued Contributor

      PaulDBrown 

      Thank you, I have just got there!!

       

      Returning Client = 
      CALCULATE(
          DISTINCTCOUNT( 'Application Status Change'[Application Number]),
          ALLEXCEPT( 'Application Status Change' , 'Application Status Change'[Client Number])
      )

       

       Thank you for your post. I am just messing with the visuals to see what I can do with it. 

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

        DemoFour 

        Happy to help!

        BTW, if you want to show only "returning" clients (ie, those with more than one application) you can do this easily using the measure in the filter pane: select the table visual, go to "filters on this visual" in the filter pane, add the measure and set the value to "greater than" 1