DAX Feedback Request

Hi everyone, I would like to share this comparison for feedback from the forum. Both formulas iterate the average time in status of total loans for each underwriter ( row ). It takes into account zero values as well as the total average ( total row ). Both have the same results on the matrix.

VERSION 1

VAR _oneValue = HASONEVALUE ( UWtracker[AssignedUW] )
VAR _avgx =
AVERAGEX (
    ADDCOLUMNS (
        SUMMARIZE ( UWtracker, UWtracker[Loan Number], UWtracker[Days] ),
        "@Days",
            CALCULATE (
                IF (
                    NOT ( ISBLANK ( SELECTEDVALUE ( UWtracker[AssignedUW] ) ) ),
                    VALUES ( UWtracker[Days] )
                )
            )
    ),
    [@Days]
)
VAR _result =
    SWITCH ( TRUE (), _oneValue, _avgx + 0, _avgx )
RETURN
    _result

VERSION 2

VAR _notBlank =
    NOT ( ISBLANK ( SELECTEDVALUE ( Underwriters[AssignedUW] ) ) )
VAR _avgx =
    AVERAGEX (
        DISTINCT (
            SELECTCOLUMNS (
                UWtracker,
                "@Loan", UWtracker[Loan Number],
                "@Days", UWtracker[Days]
            )
        ),
        [@Days]
    )
VAR _result =
    SWITCH ( TRUE (), _notBlank, _avgx + 0, _avgx )
RETURN
    _result

Version 1 visual rendered slightly faster on the performance analyzer.

Bumping this post for more visibility from our experts and users.

I realized soon after this post that version one did not produce the desired result.

Hi @Schreg,

Based on the latest update you’ve provided, I’d like to check if you still require assistance for this post?

Thank you!

Hi @Schreg

We’ve noticed that no response was received from you on the post above.

Just following up if you still require assistance to solve your inquiry.

In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved.

not necessary

Hi @Schreg - If no help is needed. Can you mark this as solved and close it.

Thanks,
Ankit J