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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply

Find the counts of missing Accs, counts of added Accs and count of retained Accs

Table Name: Query1

Source Rep_dateAccNoRev
AB07/01/2022 12:00:00AM001120$
AB07/01/2022 12:00:00 AM123450$
AB

08/01/2022

12:00:00 AM

456100$
AB09/01/2022 12:00:00AM1234200$
AB09/01/2022 12:00:00 AM78990$

 

 

From the above table, I have to find Count of accs missing and count of accs added for previous month and current month. 

 

My current and Previous months date will change for every month. So I expect the DAX to be Dynamic.

 

For example here the previous month is 08/01/2022 in that I have 1234 account but in current month I don't see that account so 1 account deactivated.

where as a new account is added in current month then I will get 1 account added.

if the acc remains same for both the month then it goes to retained.

5 REPLIES 5

@FreemanZ ,

 

The CountActive and Count Missing DAX looks the same. How come the Active and Deacts would differ. Could please help

that is your business logic. Retain means an account needs to present in both months, so is INTERSECT. 

@FreemanZ, I want to show the counts of Deacts in a separate table and with the formula what I have it is not working as expected. Please help

@SandhyaGiriraj what does Deacts mean in your case?

FreemanZ
Super User
Super User

Something like this?

FreemanZ_0-1669082702732.png

 

the code for three measures:

CountRetain =
VAR AccListCurrent =  
    VALUES (TableName[AccNO])
VAR AccListLastMonth =
    CALCULATETABLE(
        VALUES(TableName[AccNO]),
        DATEADD(TableName[Date], -1, MONTH)
    )
RETURN
    COUNTROWS(
        INTERSECT(AccListCurrent,  AccListLastMonth)
    )
 
CountNew =
VAR AccListCurrent =  
    VALUES (TableName[AccNO])
VAR AccListLastMonth =
    CALCULATETABLE(
        VALUES(TableName[AccNO]),
        DATEADD(TableName[Date], -1, MONTH)
    )
RETURN
    COUNTROWS(
        EXCEPT(AccListCurrent,  AccListLastMonth)
    )
 
CountMissing =
VAR AccListCurrent =  
    VALUES (TableName[AccNO])
VAR AccListLastMonth =
    CALCULATETABLE(
        VALUES(TableName[AccNO]),
        DATEADD(TableName[Date], -1, MONTH)
    )
RETURN
    COUNTROWS(
        EXCEPT( AccListLastMonth, AccListCurrent)
    )
 
FreemanZ_1-1669082951206.png

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.