Forum Discussion

ssharm43's avatar
ssharm43
Helper I
6 years ago
Solved

Need Help in calculating sum with condition

Hello guya, Hope you all are safe, I have a requirment where I need to calculate sum of quantity based on certain filter and condition. conditions are: 1. if Type = "inf" then only calculate sum ...
  • mahoneypat's avatar
    mahoneypat
    6 years ago

    You can just add that into the Calculate()

     

    SumIF inf %A% =
    CALCULATE (
        SUM ( 'Type'[QUANTITY] ),
        'Type'[QUANTITY] > 0,
        FILTER (
            'Type',
            OR (
                'Type'[Type] <> "inf",
                AND ( 'Type'[Type] = "inf", SEARCH ( "{A}", 'Type'[Con_type],, 0 ) > 0 )
            )
        )
    )

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat