Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Transformed Table Measure

Hi Expert,   I would like to have 2 measures that to transform table   Raw data is like this   Customer Code Item Amount A 01 MM 100 A 01 NN 200 A 02 ZZ 300 B 01 MM...
  • Nathaniel_C's avatar
    Nathaniel_C
    6 years ago

    Anonymous ,

    Ok then! Added a column to check on whether the customer had 1. Here is my pbix. Count of 1 and 2

     

    Sum of 2 = 
    
    var _code = 2
    var _calc = CALCULATE([Sum of Amount],'Count'[Code]=2,'Count'[IF Customer has 1]>=1)
    
    
    return _calc

     


    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel

  • Nathaniel_C's avatar
    Nathaniel_C
    6 years ago

    Hi Anonymous ,

    This is the new Sum of 2, which does not need the Calculated Column.  Had to go to another guy on the leaderboards jdbuchanan71 .

    Whew!


    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel

     

    Sum of 2 =
    VAR _CustList =
        CALCULATETABLE (
            INTERSECT (
                CALCULATETABLE ( DISTINCT ( 'Count'[Customer] ), 'Count'[Code] = 1 ),
                CALCULATETABLE ( DISTINCT ( 'Count'[Customer] ), 'Count'[Code] = 2 )
            ),
            ALLEXCEPT ( 'Count', 'Count'[Customer] )
        )
    RETURN
        CALCULATE (
            SUM ( 'Count'[Amount] ),
            'Count'[Customer] IN ( _CustList ),
            KEEPFILTERS ( 'Count'[Code] = 2 )
        )