0

I am trying to run some analysis, and typed a formula to attempt to do so, but the DAX is giving me the redline error, with no error message.

I have no idea why this formula wont run, so any suggestions would be appreciated. Here is a screenshot:

enter image description here

Tried recreating the formula, modifying, etc, but nothing would push it through. Any help would be super appreciated.

Also a copy of the formula:

Customer Retention % = 
VAR CurrentMonthAfter = SELECTEDVALUE('Months After'[Value])
VAR CurrentFirstOrderMonth = SELECTEDVALUE('JOD REPORTS'[First Order Date (EOM)])
Return
DIVIDE(
    CALCULATE(
        DISTINCTCOUNT('JOD REPORTS'[Customer Number]),
        FILTER(
            'JOD REPORTS',
            EOMONTH('JOD REPORTS'[Order Date],0) = EOMONTH(CurrentFirstOrderMonth,CurrentMonthAfter)
        )
    ),
    DISTINCTCOUNT('JOD REPORTS'[Customer Number])
)
3
  • Pass your cursor on the red rectangle in the right bottom side Commented Sep 1, 2024 at 12:35
  • @AmiraBedhiafi No dialogue box pops up when I hover the red. It only shows up when I am on the very outside of the textbook, and doesnt give any prompts, error codes, popups, etc Commented Sep 1, 2024 at 15:30
  • I have a doubt with your numerator have you tried using variables? Commented Sep 1, 2024 at 19:54

1 Answer 1

0

I have a doubt with your numerator so you may need to use variables to make your code easier to read and debug :

Customer Retention % = 
VAR CurrentMonthAfter = SELECTEDVALUE('Months After'[Value])
VAR CurrentFirstOrderMonth = SELECTEDVALUE('JOD REPORTS'[First Order Date (EOM)])
VAR CurrentEOMonth = EOMONTH(CurrentFirstOrderMonth, CurrentMonthAfter)

VAR DistinctCustomerCount =
    CALCULATE(
        DISTINCTCOUNT('JOD REPORTS'[Customer Number]),
        FILTER(
            'JOD REPORTS',
            EOMONTH('JOD REPORTS'[Order Date], 0) = CurrentEOMonth
        )
    )

VAR TotalDistinctCustomerCount = DISTINCTCOUNT('JOD REPORTS'[Customer Number])

RETURN
DIVIDE(DistinctCustomerCount, TotalDistinctCustomerCount)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.