Forum Discussion

karthikponnaih's avatar
karthikponnaih
Frequent Visitor
6 years ago

Calculate Monthly Retention Performance

Hi

 

I am new to PowerBI and trying to create a POC for our business requirements.


Attached the dataset and information around the data. Could someone help me in find the monthly retention performance for the  product "flex".

 

customer_idproduct_nameinception_policy_ideffective_start_dateeffective_end_date
9515flex13155505-09-201705-09-2017
9515flex14284327-09-201727-09-2017
9515flex14579902-10-201702-10-2017
7863flex14624103-10-201703-10-2017
9515flex14749705-10-201705-10-2017
9515flex14836406-10-201706-10-2017
7863flex16999008-11-201708-11-2017
9515flex16985808-11-201708-11-2017
7863flex17524413-11-201713-11-2017
7863flex17790816-11-201716-11-2017
9515flex17950517-11-201717-11-2017
7863flex18628723-11-201723-11-2017
9515flex19908105-12-201705-12-2017
7863flex19955706-12-201706-12-2017
9515flex21016419-12-201719-12-2017
9515flex21280022-12-201722-12-2017
7863flex21662929-12-201729-12-2017
9515flex21870102-01-201802-01-2018
9515flex22038404-01-201804-01-2018
9515flex22610411-01-201811-01-2018
22597flex22603811-01-201811-01-2018
22597flex22606011-01-201811-01-2018
1991flex22687812-01-201812-01-2018
7863flex25375103-02-201803-02-2018
18820flex25433103-02-201803-02-2018
1991rsa22687810-01-201812-01-2018
7863rsa25375105-02-201809-02-2018
18820rsa25433108-02-201809-02-2018

 

Thanks very much. 

3 Replies

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, karthikponnaih 

     

    I wonder the definition of monthly retention performance. If you want to count the number of records where the current month-year is between the start date and the end date and the product name is 'flex', you may try the following steps.

     

    Table:

     

    Calendar:

     

    Calendar = CALENDARAUTO()

     

     

    You may create a calculated column and a measure as below.

     

    Calculated column:
    Month-Year = VALUE(FORMAT('Calendar'[Date],"yyyymm"))
    
    Measure:
    Result = 
    var _monthyear = SELECTEDVALUE('Calendar'[Month-Year])
    var tab = 
    ADDCOLUMNS(
        ALLSELECTED('Table'),
        "startmonthyear",
        VALUE(FORMAT('Table'[effective_start_date],"yyyymm")),
        "endmonthyear",
        VALUE(FORMAT('Table'[effective_end_date],"yyyymm"))
    )
    var newtab = 
    ADDCOLUMNS(
        tab,
        "flag",
        IF(
           _monthyear>=[startmonthyear]&&
           _monthyear<=[endmonthyear],
           1,0
        )
    )
    
    return
    COUNTROWS(
        FILTER(
            newtab,
            [flag] = 1&&
            [product_name] = "flex"
        )
    )

     

     

    Result:

     

    Best Regards

    Allan

     

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

     

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, karthikponnaih 

     

    If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.

     

    Best Regards

    Allan