Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

IF Statement - Custom Column + Measure

Hi all,   I have a table where the second last column (Total number of products launched) is a custom column, and the last column (number of products launched for the selected years) is a calculate...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    I created some data:

    Here are the steps you can follow:

    1. Create calculated column.

     

    Total number of products launched_Column =
    SUMX(FILTER(ALL('Table'),'Table'[Group]="launched"),[product number])

     

    2. Create measure.

     

    number of products launched for the selected years =
    var _select=SELECTEDVALUE('Table'[Year])
    return
    SUMX(FILTER(ALL('Table'),'Table'[Group]="launched"&&'Table'[Year]<=_select),[product number])
    Flag =
    IF(
        MAX('Table'[Total number of products launched_Column])=[number of products launched for the selected years],"True","False")
    Flag1 =
    IF(
    ISERROR(
            SEARCH("True",[Flag]))
        ,
        "true",
        [Flag]
    )

     

    3. Result:

     

    Best Regards,

    Liu Yang

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