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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
slyfox
Helper II
Helper II

Customer Retention

Hello 

 

What measure can be used to identify customers with

- No sales in Selected Month

- No sales in Previous Month

- No sales in Previous 3 Month ?

 

PBI file

 

Cus Ret.png

5 REPLIES 5
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @slyfox,

 

Please try below measures:

No sales in selected Month =
IF (
    CALCULATE (
        SUM ( F_Invoice[Qty] ),
        FILTER (
            ALL ( F_Invoice ),
            F_Invoice[LINK_Customer] = SELECTEDVALUE ( D_Customer[LINK_Customer] )
                && YEAR ( F_Invoice[LINK_Date] ) = SELECTEDVALUE ( D_Date[DATE_YearNumber] )
                && MONTH ( F_Invoice[LINK_Date] ) = SELECTEDVALUE ( D_Date[DATE_MonthNumber] )
        )
    )
        = BLANK (),
    "No sales",
    "Have Sales"
)

No sales in previous Month =
VAR previousYearNumber =
    IF (
        SELECTEDVALUE ( D_Date[DATE_MonthNumber] ) = 1,
        SELECTEDVALUE ( D_Date[DATE_YearNumber] ) - 1,
        SELECTEDVALUE ( D_Date[DATE_YearNumber] )
    )
VAR previousMonthNumber =
    IF (
        SELECTEDVALUE ( D_Date[DATE_MonthNumber] ) = 1,
        12,
        SELECTEDVALUE ( D_Date[DATE_MonthNumber] ) - 1
    )
RETURN
    IF (
        CALCULATE (
            SUM ( F_Invoice[Qty] ),
            FILTER (
                ALL ( F_Invoice ),
                F_Invoice[LINK_Customer] = SELECTEDVALUE ( D_Customer[LINK_Customer] )
                    && YEAR ( F_Invoice[LINK_Date] ) = previousYearNumber
                    && MONTH ( F_Invoice[LINK_Date] ) = previousMonthNumber
            )
        )
            = BLANK (),
        "No sales",
        "Have Sales"
    )

No sales in previous 3 Month =
IF (
    CALCULATE (
        SUM ( F_Invoice[Qty] ),
        DATESINPERIOD (
            D_Date[DATE_Date].[Date],
            DATE ( SELECTEDVALUE ( D_Date[DATE_YearNumber] ), SELECTEDVALUE ( D_Date[DATE_MonthNumber] ), 1 ),
            -3,
            MONTH
        ),
        FILTER (
            ALL ( F_Invoice ),
            F_Invoice[LINK_Customer] = SELECTEDVALUE ( D_Customer[LINK_Customer] )
        )
    )
        = BLANK (),
    "No sales",
    "Have Sales"
)

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.

Dear @v-yulgu-msft

 

The problem is that the grand total on the column does not display the sum of such customers for which there were no sales.

Could be possible to adjust your measures ?

up

slyfox
Helper II
Helper II

Up

up

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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