Power BI measure blank function appearing 0 for the unknown source column in the table

Viewed 38
TAT (sec) =
IF (
    DATEDIFF (
        MAX ( quotes[Request Date-time] ),
        MAX ( quotes[Assessment Date&Time] ),
        SECOND
    )
        = BLANK (),
    0,
    DATEDIFF (
        MAX ( quotes[Request Date-time] ),
        MAX ( quotes[Assessment Date&Time] ),
        SECOND
    )
)

I wrote this measure to print if there is a blank return 0, but the measure returning 0 for the unknown values also(if the source column is not even though present )enter image description here

1 Answers

If you get an empty row, it means that your have a problem with a data integrity in your model. For example, you have in facts a category with {A,B,C,D} values and in a category table only {B,C}. If you add category to rows you will get {empty (for A,D),B,C}. So, in general it happens when you have not valid links on "one" side for "one to" link. You can simply exclude the empty row from your report, but it's better to adjust your data model.

you'll get the same result with:

DATEDIFF(MAX(quotes[Request Date-time]),Max(quotes[Assessment Date&Time]),SECOND) + 0

I'd try:

IF(
    ISBLANK(SELECTEDVALUE(quotedId))
    ,BLANK()
    ,DATEDIFF(
        MAX(quotes[Request Date-time])
       ,Max(quotes[Assessment Date&Time])
       ,SECOND
    ) + 0
)

I didn't test, so can't guarantee.

Related