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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply

Find the count of missing acc and added acc

Hi  all,

 

Source R_DateAcc
C2022-Jul123
B2022-Aug 321
C2022-Aug1234

 

Using the table I wanna find out, 

Count of Acc missing in August and Counts of Accounts newly added in August.

for example, in the table for the source C we have account in july but that account was deactivated in august and there is an new account added in august for source C.  Get the counts of deactivated accs and activated.

 

I have to get the accounts deactivated in a separate table and accounts newly added in separate table comparing the months. 

 

Please Help.

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @SandhyaGiriraj ,

 

My Sample:

RicoZhou_1-1668674602932.png

Please try below code to create a measure.

Active = 
CALCULATE(DISTINCTCOUNT('Table'[Source ]),FILTER(ALL('Table'),'Table'[R_Date]<=MAX('Table'[R_Date])))
Deactive = 
VAR _ADD =
    ADDCOLUMNS (
        ALL ( 'Table' ),
        "Previous",
            CALCULATE (
                MAX ( 'Table'[R_Date] ),
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Source ] = EARLIER ( 'Table'[Source ] )
                        && 'Table'[R_Date] < EARLIER ( 'Table'[R_Date] )
                )
            )
    )
RETURN
    COUNTAX (
        FILTER ( _ADD, [R_Date] = MAX ( 'Table'[R_Date] ) && [Previous] <> BLANK () ),
        [Source ]
    )

Result is as below.

RicoZhou_0-1668674590897.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @SandhyaGiriraj ,

 

My Sample:

RicoZhou_1-1668674602932.png

Please try below code to create a measure.

Active = 
CALCULATE(DISTINCTCOUNT('Table'[Source ]),FILTER(ALL('Table'),'Table'[R_Date]<=MAX('Table'[R_Date])))
Deactive = 
VAR _ADD =
    ADDCOLUMNS (
        ALL ( 'Table' ),
        "Previous",
            CALCULATE (
                MAX ( 'Table'[R_Date] ),
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Source ] = EARLIER ( 'Table'[Source ] )
                        && 'Table'[R_Date] < EARLIER ( 'Table'[R_Date] )
                )
            )
    )
RETURN
    COUNTAX (
        FILTER ( _ADD, [R_Date] = MAX ( 'Table'[R_Date] ) && [Previous] <> BLANK () ),
        [Source ]
    )

Result is as below.

RicoZhou_0-1668674590897.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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