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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Count of users whose status flag changes from 0 to 1

Dear All,

 

I need help on writing DAX for calculating the count of customers whose status flag is changing from 0 to 1 in a particular month.

where 0 indicates new user (first order)and 1 indicates repeat user (2nd order).

Please help on writing DAX query for

1. No . of users whose  status flag changing from 0 to 1

2. And only count of users with status indicator 1 (exclude users with status flag changes from 0 to 1)  in a particular month

 

Repeate customer count.png

Thanks & Regards,

Rajeev Bikkani

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please create measures like below:

Count repeat =
CALCULATE (
    DISTINCTCOUNT ( Cust_Order[Cust_Ord_Rept_in] ),
    ALLSELECTED ( Cust_Order[Cust_Ord_Rept_in] )
)

count custom 1=
CALCULATE (
    DISTINCTCOUNT ( Cust_Order[Ord_Cust_Id] ),
    FILTER ( ALLEXCEPT ( Cust_Order, Cust_Order[Month] ), [Count repeat] = 2 )
)

count custom 2 =
CALCULATE (
    DISTINCTCOUNT ( Cust_Order[Ord_Cust_Id] ),
    FILTER (
        ALLEXCEPT ( Cust_Order, Cust_Order[Month] ),
        [Count repeat] = 1
            && Cust_Order[Cust_Ord_Rept_in] = 1
    )
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please create measures like below:

Count repeat =
CALCULATE (
    DISTINCTCOUNT ( Cust_Order[Cust_Ord_Rept_in] ),
    ALLSELECTED ( Cust_Order[Cust_Ord_Rept_in] )
)

count custom 1=
CALCULATE (
    DISTINCTCOUNT ( Cust_Order[Ord_Cust_Id] ),
    FILTER ( ALLEXCEPT ( Cust_Order, Cust_Order[Month] ), [Count repeat] = 2 )
)

count custom 2 =
CALCULATE (
    DISTINCTCOUNT ( Cust_Order[Ord_Cust_Id] ),
    FILTER (
        ALLEXCEPT ( Cust_Order, Cust_Order[Month] ),
        [Count repeat] = 1
            && Cust_Order[Cust_Ord_Rept_in] = 1
    )
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Yuliana,

 

Thankyou for providing the solution.

 

Thanks & Regards,

Rajeev Bikkani

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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