Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
5 years ago
Solved

How I accumulate clients different months

Hello Community, Good day, someone can give me a light with the next problem in power BI. Example: I have a list of clients in the course of the year where a client can be served more than once i...
  • PaulDBrown's avatar
    PaulDBrown
    5 years ago

    Ok. With this model:

    And these measures:

    Number of attentions = COUNT(FactTable[CUSTOMER])
    Distinct Customers = DISTINCTCOUNT(FactTable[CUSTOMER])

    and..

    New customers =
    CALCULATE (
        DISTINCTCOUNT ( FactTable[CUSTOMER] ),
        FILTER (
            ALL ( 'Date Table' ),
            'Date Table'[Date] <= MAX ( 'Date Table'[Date] )
        )
    )
    

     

    You get the following:

     

     

  • PaulDBrown's avatar
    PaulDBrown
    5 years ago

    This should work:

    New customers =
    VAR _Year = SELECTEDVALUE ( Date Table [Year] )
    CALCULATE (
        DISTINCTCOUNT ( FactTable[CUSTOMER] ),
        FILTER (
            ALL ( 'Date Table' ),
            'Date Table'[Date] <= MAX ( 'Date Table'[Date] )
            && Date Table [Year] = _Year
        )
    )