Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

SUMIF/IF formulas

Hi, I am trying to write the following excel formulas in DAX:  =SUMIF(O:O;"<="&O2;H:H)  ---> sum column H for all values where O is less than or equal to the current O cell.    and    =IF(P2<=SU...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi  Anonymous ,

     

    According to your description, I created some data to show:

    Here are the steps you can follow:

    1. Create calculated table.

    H =
    CALCULATE(SUM('Table'[O]),FILTER('Table','Table'[O]<=EARLIER('Table'[O])))
    P1 =
    SWITCH(
        TRUE(),
        'Table'[P2]<=DIVIDE(SUM('Table'[H]),10),1,
        'Table'[P2]<=DIVIDE(SUM('Table'[H]),10)*2, 2,
        BLANK())

    2. Result.

    You can downloaded PBIX file from here.

     

    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.