Forum Discussion

Abrar786's avatar
Abrar786
Icon for Helper I rankHelper I
3 years ago

Incorrect total for column in matrix

Hello,

I am getting an incorrect total for my measure. Please see below for the details of my measure.

 

 

 

Increase Sale =

VAR customers =
    FILTER (
        ADDCOLUMNS (
            DISTINCT ( invoices_details[customer_no] ),
            "@CYSale", [Total Sale],
            "@LYSale", [LY Sale],
            "@SaleDiff", [Total Sale] - [LY Sale]
        ),
        [@CYSale] > 0
            && [@LYSale] > 0
            && [@CYSale] > [@LYSale]
            && COUNTROWS (
                FILTER (
                    'category',
                    [@SaleDiff] >= 'category'[category min value]
                        && [@SaleDiff] < 'category'[category max value]
                )
            ) > 0
    )
   
RETURN
    SUMX ( customers, [@SaleDiff] )
 
Thank you in advance for the help.

 

3 Replies

  • Abrar786 , Try two measures like

     

    Inc =COUNTROWS (
    FILTER (
    'category',
    [@SaleDiff] >= 'category'[category min value]
    && [@SaleDiff] < 'category'[category max value]
    )
    )


    Increase Sale =

    Sumx(FILTER (
    ADDCOLUMNS (
    values ( invoices_details[customer_no] ),
    "@CYSale", [Total Sale],
    "@LYSale", [LY Sale],
    "@SaleDiff", [Total Sale] - [LY Sale]
    ),
    [@CYSale] > 0
    && [@LYSale] > 0
    && [@CYSale] > [@LYSale]
    && [Inc]> 0
    ),[@SaleDiff])

  • write another measure like this

    SUMX ( VALUES('table'[category Name]), [Increase Sale]