Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
David_1970
Frequent Visitor

DAX-formula counting clients

Hi, I want to be able to count the number of clients. However, if a new client becomes assigned to an already existing client group, that client should not be considered a new client. This is the case for clients 2 and 4 in the table below. Thus, in January one client was created; in February there were zero clients created; in June one client; and in October there were two new clients. Any suggestions for a DAX-formula?

 

Client group numberClient numberCreation date
112014-01-01
122014-02-01
332014-06-19
142014-06-23
552014-10-26
662014-10-28
1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @David_1970

 

Try this solution

 

Add a calculated column as follows

 

Index =
IF (
    CALCULATE (
        COUNTROWS ( TableName ),
        FILTER (
            TableName,
            MONTH ( TableName[Creation date] )
                < MONTH ( EARLIER ( TableName[Creation date] ) )
                && TableName[Client group number] = EARLIER ( TableName[Client group number] )
        )
    )
        >= 1,
    BLANK (),
    1
)

201.png

 

 

Now Sum of this Index will give you desired RESULTS

 

Just Add Month and Sum of Index to a TABLE visual

202.png

 

 


Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

Hi @David_1970

 

Try this solution

 

Add a calculated column as follows

 

Index =
IF (
    CALCULATE (
        COUNTROWS ( TableName ),
        FILTER (
            TableName,
            MONTH ( TableName[Creation date] )
                < MONTH ( EARLIER ( TableName[Creation date] ) )
                && TableName[Client group number] = EARLIER ( TableName[Client group number] )
        )
    )
        >= 1,
    BLANK (),
    1
)

201.png

 

 

Now Sum of this Index will give you desired RESULTS

 

Just Add Month and Sum of Index to a TABLE visual

202.png

 

 


Regards
Zubair

Please try my custom visuals

Hi @David_1970

 

File attached here

(with your sample data)


Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.