Forum Discussion

Hongmingk's avatar
Hongmingk
Frequent Visitor
2 years ago
Solved

Cumulative Reject Count

Hi all,   I have a table with all the rejects information for individual items. I want to do a cumulative of all the rejects description for individual items.    As you can see above, t...
  • Jihwan_Kim's avatar
    Jihwan_Kim
    2 years ago

    Hi,

    Please check the below picture and the attached pbix file if it suits your requirement.

     

     

    _cumReject =
    IF (
        ISINSCOPE ( 'Reject Data'[Reject Desciption] ),
        VAR _allselectedComp =
            ALLSELECTED ( 'Reject Data'[Reject Desciption] )
        VAR _CompTable =
            ADDCOLUMNS ( _allselectedComp, "@Count", 'Reject Data'[Reject Count] )
        RETURN
            SUMX (
                WINDOW (
                    1,
                    ABS,
                    0,
                    REL,
                    _CompTable,
                    ORDERBY ( [@Count], DESC, 'Reject Data'[Reject Desciption], ASC )
                ),
                [@Count]
            )
    )