Forum Discussion

vbvbvb's avatar
vbvbvb
Icon for Microsoft Employee rankMicrosoft Employee
3 years ago
Solved

Add filter to show specific values in calculated columns

Hi all,   Trying to solve following task.  I have data in more or less same format, where final goal is to calculate Aveage value based on Month and Year values:   Name of colour Certain Valu...
  • v-yanjiang-msft's avatar
    v-yanjiang-msft
    3 years ago

    Hi vbvbvb

    Modify the formula to:

    AvgValue Blue =
    VAR _table =
        FILTER (
            TableName,
            TableName[Year] = EARLIER ( TableName[Year] )
                && TableName[Month] = EARLIER ( TableName[Month] )
                && TableName[Certain Value] <> BLANK ()
                && 'TableName'[Name of colour] IN { "Blue" }
        )
    RETURN
        IF (
            [Name of colour] IN { "Blue" },
            SUMX ( _table, TableName[Certain Value] / COUNTROWS ( _table ) )
        )
    

    I add an if condition in the code, tweak the color in different color columns.

     

    I attach my sample below for your reference.

    Best Regards,
    Community Support Team _ kalyj

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