Forum Discussion

ravirayala4252's avatar
3 years ago

How to solve this problem ?..

Hello Everyone 
I have a situation here,Request you all to help me with the Solution 

 

4 Replies

    • ravirayala4252's avatar
      ravirayala4252
      Helper I

      Hi Mahesh0016 

      Here is the Sample Dataset as you want, please suggest me the Possible Solutions.

      I need a Dax measure which result the following 3 conditions.
      1. Calculate Sum actual Activity in table B based on matching ID from table A.
      2. Calculate Sum actual Activity in table B by not Matching ID & matching ITEMS from table A.
      3. Calculate Sum of actual Activity in table B by not Matching ID & not matching ITEM from table A.
      A single measure which results all the above conditions?.

       

      Table A:

      IDITEMLOCATIONPlanned ActivityType
      1Nulla10Solid
      1Nulla5Solid
      2Nullb4Solid
      2Nullc6Solid
      3Nulld7Solid
      3Nulle8Solid
      4Nullf11Solid
      4Nullg12Solid
      NullAh13Tentative
      NullBi9Tentative
      NullCj4Tentative
      NullDk5Tentative
      NullEl6Tentative
      NullFm7Tentative
      NullGn8Tentative
      NullHo9Tentative
         50Unplanned



        Table B 
      IDITEMLOCATIONActual Activity
      1Aa10
      1Ba5
      2Cb4
      2Cc6
      3Nulld7
      3Nulle8
      4Nullf11
      4Nullg12
      5Dh13
      6Di9
      6Nullj4
      7Nullk5
      8Nulll6
      8Nullm7
      9En8
      9Eo9
      10Fl10
      10Nullm11
      11Nulll12
      12Nullg11
      13Nullh12
      13Nullg13
      14Nullh11
      14Nullm12
  • Hello ravirayala4252 

    Total Activity :

       Total Activity = SUM('Table B'[Actual Activity])
     
    > 1. Calculate Sum actual Activity in table B based on matching ID from table A.
    matching ID from table A = 
    CALCULATE (
        [Total Activity],
        FILTER (
            'Table B',
            'Table B'[ID] = LOOKUPVALUE ( 'Table A'[ID], 'Table A'[ID], 'Table B'[ID] )
        )
    )

    2. Calculate Sum actual Activity in table B by not Matching ID & matching ITEMS from table A.

    matching ITEMS from table A = 

    CALCULATE (

        [Total Activity],

        FILTER (

            'Table B',

            'Table B'[ID] <> LOOKUPVALUE ( 'Table A'[ID], 'Table A'[ID], 'Table B'[ID] )

        &&  'Table B'[ITEM] = LOOKUPVALUE ( 'Table A'[ITEM], 'Table A'[ID], 'Table B'[ID] )

        )

    )

    > 3. Calculate Sum of actual Activity in table B by not Matching ID & not matching ITEM from table A.A single                measure which results all the above conditions?.

    Not matching from table A = 

    CALCULATE (

        [Total Activity],

        FILTER (

            'Table B',

            'Table B'[ID] <> LOOKUPVALUE ( 'Table A'[ID], 'Table A'[ID], 'Table B'[ID] )

        &&  'Table B'[ITEM] <> LOOKUPVALUE ( 'Table A'[ITEM], 'Table A'[ID], 'Table B'[ID] )

        )

    )



    ravirayala4252  I hope this hepls you! Thank You!!