Forum Discussion

MiKeZZa's avatar
MiKeZZa
Post Patron
7 years ago
Solved

DAX - Exclude values from row total

I want to exclude some values from my total on a row.   I've tried some things and I have the feeling that I'm almost there. As you can see I've excluded the red cells from the total in purple, but...
  • AlB's avatar
    AlB
    7 years ago

    MiKeZZa

     

    Well, "no success at all" sounds like a bit of an exaggeration... 

    (N+1)th version.  I had posted this already immediately after my latest post as I realised there was an error.  But for some reason the post has disappeared. Here it is again

     

    totalamount_openD = 
    VAR income =
        CALCULATE ( SUM ( 'table'[amount] ); 'table'[header] = "income" )
    VAR costs =
        CALCULATE ( SUM ( 'table'[amount] ); 'table'[header] = "costs" )
    VAR income_open =
        CALCULATE ( SUM ( 'table'[amount_open] ); 'table'[header] = "income" )
    VAR costs_open =
        CALCULATE ( SUM ( 'table'[amount_open] ); 'table'[header] = "costs" )
    RETURN
        IF (
            ISFILTERED ( date_table[yearmonth] );
            IF (
                ISFILTERED ( 'table'[header] );
                CALCULATE ( SUM ( 'table'[amount] ) );
                income - costs
            );
            IF (
                ISFILTERED ( 'table'[header] );
                CALCULATE ( SUM ( 'table'[amount_open] ) );
                income_open - costs_open
            )
        )