cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rajeevbikkani Regular Visitor
Regular Visitor

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

Accepted Solutions
Community Support Team
Community Support Team

Re: Count of users whose status flag changes from 0 to 1

Hi @rajeevbikkani,

 

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.
2 REPLIES 2
Community Support Team
Community Support Team

Re: Count of users whose status flag changes from 0 to 1

Hi @rajeevbikkani,

 

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.
rajeevbikkani Regular Visitor
Regular Visitor

Re: Count of users whose status flag changes from 0 to 1

Hi Yuliana,

 

Thankyou for providing the solution.

 

Thanks & Regards,

Rajeev Bikkani