Forum Discussion

dkushner's avatar
dkushner
Frequent Visitor
8 years ago
Solved

Additional filter into measure

Hello everybody, I have a table of values ID CounterNumber ReqDateT DataDateT SummAPlus 68511 139 2018-02-06 17:14:45.000 2018-02-05 00:00:00.000 11632,8 68512...
  • v-piga-msft's avatar
    v-piga-msft
    8 years ago

    Hi dkushner,

     

    From the description of your replay, you should create a calculated table first in the formula below to get the max value of SummAPlus for the each of CounterNumber by DataDateT.

     

    Table =
    SUMMARIZE (
        PowerCountersPreviousDay,
        PowerCountersPreviousDay[DataDateT],
        PowerCountersPreviousDay[CounterNumber],
        "Sumsingle", MAX ( 'PowerCountersPreviousDay'[SummAPlus] )
    )

    Then, you could the measure :

     

    Bussiness Unit =
    VAR count1sum =
        CALCULATE (
            SUM ( 'Table'[Sumsingle] ),
            FILTER ( ALL ( 'Table'[CounterNumber] ), 'Table'[CounterNumber] = 1 )
        )
    VAR count139sum =
        CALCULATE (
            SUM ( 'Table'[Sumsingle] ),
            FILTER ( ALL ( 'Table'[CounterNumber] ), 'Table'[CounterNumber] = 139 )
        )
    VAR count149sum =
        CALCULATE (
            SUM ( 'Table'[Sumsingle] ),
            FILTER ( ALL ( 'Table'[CounterNumber] ), 'Table'[CounterNumber] = 149 )
        )
    RETURN
        count139sum + count1sum
            - count149sum

    This picture of the result is below:

     

     

     

    For  more details, you could refer to this pbix file.

     

    Hope it can help you!

     

    Best Regards,

    Cherry