Forum Discussion

emilyh1's avatar
emilyh1
Frequent Visitor
2 years ago
Solved

Measure not returning correct vale

I am trying to write a measure that will return "T" if the statement is true and "F" if it is false. The measure is supposed to look at a certain column to see if that value is true, but it is not working properly. 

 

Example columns: 

Task, Percent Complete, Finish Number 

1, 100, -74

2, 100, -25

3, 95, 24

 

If I write the code 

Filter = 

Return(

IF((PercentComplete = 100 && FinishNum >= -30) || (PComp <= 100) , "T" , "F"))
 
This code will always return "T", even though task 1 should be "F". I am not sure how to correct this, as I also used a Switch statement and it was returning the same thing. It would not recognize the correct percent complete values. I currently have those stored as whole numbers. 
  • Hi,
    I didn't understand your logic but if you want the first row returns "F", try this (Calculated Column) :

    SWITCH(
        TRUE(),
        T_Task[PercentComplete]=100 && T_Task[FinishNumber] >=-30 ,"T",
        T_Task[PercentComplete]<100, "T",
        "F"
    )

    I hope this could help you.

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi emilyh1 ,

     

    Thank you emilyh1 for the quick response and solution. Here is the version of the measure I added:

    Filter = 
    SWITCH(
        TRUE(),
        MAX('T_Task'[Percent Complete])=100 && MAX('T_Task'[Finish Number]) >=-30 ,"T",
        MAX('T_Task'[Percent Complete])<100, "T",
        "F"
    )

    Then the result is as follows.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

     

2 Replies

  • _AAndrade's avatar
    _AAndrade
    Resident Rockstar

    Hi,
    I didn't understand your logic but if you want the first row returns "F", try this (Calculated Column) :

    SWITCH(
        TRUE(),
        T_Task[PercentComplete]=100 && T_Task[FinishNumber] >=-30 ,"T",
        T_Task[PercentComplete]<100, "T",
        "F"
    )

    I hope this could help you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi emilyh1 ,

     

    Thank you emilyh1 for the quick response and solution. Here is the version of the measure I added:

    Filter = 
    SWITCH(
        TRUE(),
        MAX('T_Task'[Percent Complete])=100 && MAX('T_Task'[Finish Number]) >=-30 ,"T",
        MAX('T_Task'[Percent Complete])<100, "T",
        "F"
    )

    Then the result is as follows.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly.