Forum Discussion

lc1's avatar
lc1
Icon for Helper III rankHelper III
2 years ago

Remove duplicates if condition is met

Hello,

I have two columns (Project Id) and (Fund).

I need to filter only projects that are funded 100% by PTP not partially funded.

Can someone advise the best way to obtain these results?

Thank you.

 

Proj IDFund 
75636PTPOk
3000020Grant 
3000020PTP 
3000020Operating 
3002541Operating 
3003301PTP 
3003301Grant 
3003861PTPOk

9 Replies

  • Hi lc1 

     

    Would a measure like this help?

     

    Flag = 
    VAR _Proj = MAX( 'Table1'[Proj ID] )
    VAR _Table =
        FILTER(
            ALL( 'Table1' ),
            'Table1'[Proj ID] = _Proj
        )
    VAR _All = COUNTROWS( _Table )
    VAR _PTP = 
        COUNTROWS(
            FILTER(
                _Table,
                'Table1'[Fund] = "PTP"
            )
        )
    VAR _Logic = IF( _All = _PTP, 1 )
    RETURN
        _Logic

     

    That flag can be used to filter your visual.

     

    Remove duplicates if condition is met.pbix

     

    • lc1's avatar
      lc1
      Icon for Helper III rankHelper III

      Thank you all for the responses, I tried the various solutions but could not get the results I'm looking for.

      I should've mentioned I'm working with data coming from 4 different tables:

      Table 1Table 2Table 3Table 4 
      Completion DateTotal Expenditures*Project ID* Revenue Name
          
      * Distinct value (key)  

       

      I need to create two matrixes, one with a list of projects that are 100% funded by Revenue type 1 and one table with projects that are fully and partially funded with Revenue type 1.

       

      Meaning, the second table should have all projects funded 100% with Rev type 1 in addition to other projects funded with other types of revenue.

       

  • NaveenGandhi's avatar
    NaveenGandhi
    Icon for Memorable Member rankMemorable Member

    Hi lc1 

    Please use below measure.

    PTP=
    VAR PTPProjects =
        SUMMARIZE(
            FILTER(
                'table',
                CALCULATE(
                    COUNTROWS('table'),
                    ALLEXCEPT('table', 'table'[Proj ID])
                ) = CALCULATE(
                    COUNTROWS('table'),
                    ALLEXCEPT('table', 'table'[Proj ID]),
                    'table'[Fund] = "PTP"
                )
            ),
            'table'[Proj ID]
        )
    RETURN
        if(SELECTEDVALUE('Table'[Proj ID]) IN PTPProjects,"Ok","")

    If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!

    Follow me on LinkedIn!!!




  • Hi,

    Write these measures

    Financier count = DISTINCTCOUNT(Data[Fund])
    Test = 1*(AND([Financier count]=1,MIN(Data[Fund])="PTP"))

    Drag the Test measure to the filter section and apply a condition of 1.

    Hope this helps.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi lc1 ,

     

    May I ask if the solution mentioned in the link you provided helped you?

     

    Best Regards,
    Adamk Kong

    • lc1's avatar
      lc1
      Icon for Helper III rankHelper III

      Hi, it did but not completely. But I still found it very useful.

      For the task that I had, since I had a tight deadline, I ended up doing it in excel.