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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Unknown_User
Regular Visitor

New customer DAX not working

Hello,

I have a DAX measure to calculate new customers, and it does not work correctly. I'm trying to base it on an Excel calculation IF(AND(Dec'22=0,Sep'23>0), Sep'23, 0). Not only that, but I want to modify it a bit to also include any date before Dec'22, and the Sep'22 would need to be any month in 2023.

This is my measure:

 
test 3 =
VAR __salesuptodec22 =
CALCULATE(
    SUM('Financial report'[Salespmth])
    ,DATESBETWEEN(
        'Financial report'[Cal_Date],
        MIN('Financial report'[Cal_Date]),
        DATE(2022,12,31)
    )
)

VAR __dec22 =
IF(__salesuptodec22=0,1)

VAR __jan23ow =
IF(
    CALCULATE(
        SUM('Financial report'[Salespmth]),
        DATESBETWEEN(
            'Financial report'[Cal_Date],
            DATE(2023,01,01),
            MAX('Financial report'[Cal_Date])
        )
    )
    >0,1
)

VAR __nc =
IF(__dec22 =1 && __jan23ow = 1,"new")

RETURN
IF(__nc="new",SUM('Financial report'[Salespmth]))
 
When I put it in a matrix, with company name in rows, Date in columns and test 3 in values, it still returns everything.
Would someone be able to help me fix the measure so it only would return new customers?
Thank you for your help and time.
1 REPLY 1
Fowmy
Super User
Super User

@Unknown_User 

Please follow this tutorial to get the correct result:
Customer Retention in Power BI: DAX Measures - RADACAD

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors