Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

AVG for Positive values and with the Positive Value's Row Count

I am trying to Calculate the AVERAGE only for the NON NEGATIVE numbers but only with the Positive row count.   If you look at the below data I want to calculate the AVG of MB Change Value % for Se...
  • v-yuta-msft's avatar
    7 years ago

    Anonymous ,

     

    You may modify your measure using DAX like below and check if it can meet your requirement:

    Result =
    CALCULATE (
        SUM ( 'Disk Space DW'[MB Change Value%] ),
        FILTER (
            'Disk Space DW',
            'Disk Space DW'[Computer Name] = EARLIER ( 'Disk Space DW'[Computer Name] )
                && 'Disk Space DW'[Disk] = EARLIER ( 'Disk Space DW'[Disk] )
                && 'Disk Space DW'[MB Change Value%] >= 0
        )
    )
        / COUNTROWS (
            FILTER (
                'Disk Space DW',
                'Disk Space DW'[Computer Name] = EARLIER ( 'Disk Space DW'[Computer Name] )
                    && 'Disk Space DW'[Disk] = EARLIER ( 'Disk Space DW'[Disk] )
                    && 'Disk Space DW'[MB Change Value%] >= 0
            )
        )
    

    Community Support Team _ Jimmy Tao

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