Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Summaring data from a sumx measure in different table

Hi,

I created a table that is similar to the one below:

 

 

Now I wrote a measure with sumx, that take values from a column An(|n is indicated by parameter) and Cm(same for m) and calculate (A-C)*P. Then i created a table with Country, Material and measure and filtered that measure is always greater than 0. Now i want to create a measure that will sum up all my values from measure(greater than 0) and i would like also to do a table with summarizing value with measure for every country.

 

 

Is it possible? should i build table in other way, or do some other measures? Please let me know.

Thank you in advance for responce.

Radkos

  • Hi Radkos,

     

    There is a solution without changing any model structure. Please refer to the demo in the attachment.

    Measure =
    SUMX (
        'Table1',
        VAR cValue =
            SWITCH ( [C Indicator Value], 1, 'Table1'[Cl], 2, 'Table1'[C2], BLANK () )
        VAR aValue =
            SWITCH ( [A Indicator Value], 1, [A1], 2, [A2], 3, [A3], 4, [A4], BLANK () )
        RETURN
            IF ( aValue > cValue, ( aValue - cValue ) * [P], 0 )
    )
    

    Summaring-data-from-a-sumx-measure-in-different-table

     

     

    Best Regards,
    Dale

1 Reply

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Radkos,

     

    There is a solution without changing any model structure. Please refer to the demo in the attachment.

    Measure =
    SUMX (
        'Table1',
        VAR cValue =
            SWITCH ( [C Indicator Value], 1, 'Table1'[Cl], 2, 'Table1'[C2], BLANK () )
        VAR aValue =
            SWITCH ( [A Indicator Value], 1, [A1], 2, [A2], 3, [A3], 4, [A4], BLANK () )
        RETURN
            IF ( aValue > cValue, ( aValue - cValue ) * [P], 0 )
    )
    

    Summaring-data-from-a-sumx-measure-in-different-table

     

     

    Best Regards,
    Dale