Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

how to make a conditional sum in a filtered summarized table

Hello,   I have made a summarized table using the following DAX:   Summary Table = FILTER( SUMMARIZE('TransXML Children Level','TransXML Children Level'[SBatchName],'TransXML Children Level'[...
  • v-alq-msft's avatar
    6 years ago

    Hi, Anonymous 

     

    Please try to create a calculated table as below to see if it works.

    Summary Table =
    FILTER (
        SUMMARIZE (
            'TransXML Children Level',
            'TransXML Children Level'[SBatchName],
            'TransXML Children Level'[FileName],
            'TransXML Children Level'[LockBox],
            'TransXML Children Level'[ResultStatus],
            'TransXML Children Level'[Batch Status],
            'TransXML Children Level'[Transaction Date].[Date],
            'TransXML Children Level'[Period],
            'TransXML Children Level'[Account],
            'TransXML Children Level'[NbInvoiceBAI],
            "number of invoices Posted", CALCULATE (
                DISTINCTCOUNT ( 'TransXML Children Level'[CorInvoice] ),
                FILTER (
                    'TransXML Children Level',
                    'TransXML Children Level'[CorInvoice] <> BLANK ()
                        && 'TransXML Children Level'[Batch Status] = "A"
                )
            ),
            "number of invoices  none Posted", CALCULATE (
                DISTINCTCOUNT ( 'TransXML Children Level'[CorInvoice] ),
                FILTER (
                    'TransXML Children Level',
                    'TransXML Children Level'[CorInvoice] <> BLANK ()
                        && 'TransXML Children Level'[Batch Status] = "N"
                )
            ),
            "TotalAmount", SUM ( 'TransXML Children Level'[Amount] )
        ),
        'TransXML Children Level'[ResultStatus] = "s"
            && 'TransXML Children Level'[Account] = "100"
    )

     

    Best Regards

    Allan

     

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