Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Simple IF STATEMENT asap


Hi,

Real quick one here. I have a Measure, that calcualtes what you see under here. Some on the values are blank. I want to aadd in a if statement.


TEST A =

help here: IF VALUE OF THIS MEASURE IS BLANK, RETURN (ANOTHER MEASURE) ELSE IF, USE THE MEASURE UNDER HERE.

CALCULATE (
    MAX ( 'DATASET A'[Volume p1] ),
    FILTER ( 'DATESET A', 'DATA SET A'[Dato/tid] = [Max date/time] ) 
Want to add measure of the left in measure test a, where its blank. So the output becomes 0. like 19.85 - 19.85. So want a if statment here. If test a is blank return, measure on the left. Which gives the en result 0
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi Anonymous ,

     

    Maybe you can try to use the measure if it works on your side:

    Test =
    IF (
        [Measure1] <> BLANK (),
        [Measure1],
        CALCULATE (
            MAX ( 'DATASET A'[Volume p1] ),
            FILTER ( ALLSELECTED ( 'DATESET A' ), 'DATA SET A'[Dato/tid] = [Max date/time] )
        )
    )
    

    If above not help, please share some sample data so that we can test to coding formula on it.

     

    Regards,

    Xiaoxin Sheng

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Maybe you can try to use the measure if it works on your side:

    Test =
    IF (
        [Measure1] <> BLANK (),
        [Measure1],
        CALCULATE (
            MAX ( 'DATASET A'[Volume p1] ),
            FILTER ( ALLSELECTED ( 'DATESET A' ), 'DATA SET A'[Dato/tid] = [Max date/time] )
        )
    )
    

    If above not help, please share some sample data so that we can test to coding formula on it.

     

    Regards,

    Xiaoxin Sheng