function Or In If statement DAX

Viewed 47

I currently have some columns in a power Query Table:

Client Quantity & Quantity Delivered.

I want to have a table which count "1" When Client Quantity are equal to Quantity Delivered and 0 in the contrary.

I tried this:

 [`Client Quantity`]=`Quantity delivered`],
    1,
        0
    )

Which works, but some Client Quantity and Quantity delivered are empty and power bi counts it like a 0.

I only want to keep real data

I tried this:

    Livraisons blanches = 
 IF(
         [Client Quantity]=[Quantity Delivered]
                    1,
                    IF(
                        [Client Quantity]= BLANK(),
                        BLANK,
                            IF(
                                [Quantity Delivered]=BLANK(),
                                BLANK(),
                                2
                            )
                    )
 )

But it's not currently working.

Can I regroup both Client Quantity and Client Delivered to exclude them from the count?

1 Answers

You could write it like this:

Livraisons blanches =
IF (
    ISBLANK ( [Client Quantity] ) || ISBLANK ( [Quantity Delivered] ),
    BLANK (),
    IF ( [Client Quantity] = [Quantity Delivered], 1, 0 )
)
Related