Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Count If In A Related Table

Hello,

I have a measure in Table-A that I would like to deuplicate, but only if the Unique ID is contained in Table-B, with the relationship established between the Unique ID fileds. 

So, If I have 11 records as a result of the current Measure in Table-A

How do I get this same result, but only for the 9 records with matching Unique ID in Table-B?

 

Here is the measure for Table-A:

ReStartCount = CALCULATE(StartDetail[start count], StartDetail[startdate] >= StartDetail[DateBeginFootprint], StartDetail[starttype] = "Resubscribed Start")

 

2 Replies

  • Stachu's avatar
    Stachu
    Community Champion

    Can you add sample tables (in format that can be copied to PowerBI) from your model with anonymised data? Like this (just copy and paste into the post window).

    Column1Column2
    A1
    B2.5

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Sure thing.

      In this subset, Table A has 11 rows.   In Table B (whole dataset not copied) there are 9 rows with matching Unique IDs.  I want to count just those 9 rows. 

      Thanks for the help.

       

      Table A: 

      Unique IDstarttypestartdateDateBeginFootprint
      40431973Resubscribed Start12-Aug-228/1/2022 0:00
      73209141Resubscribed Start2-Oct-228/1/2022 0:00
      73287965Resubscribed Start9-Oct-228/1/2022 0:00
      10406350Resubscribed Start4-Sep-228/1/2022 0:00
      73312306Resubscribed Start30-Oct-228/1/2022 0:00
      73333199Resubscribed Start23-Oct-228/1/2022 0:00
      50563861Resubscribed Start18-Sep-228/1/2022 0:00
      60803325Resubscribed Start14-Aug-228/1/2022 0:00
      10994140Resubscribed Start14-Aug-228/1/2022 0:00
      30972428Resubscribed Start9-Oct-228/1/2022 0:00
      40219278Resubscribed Start9-Oct-228/1/2022 0:00

       

      Table B:

      zipcodeUnique IDDateBeginFootprint
      30253AJC60398998Monday, August 01, 2022
      30253AJC73280714Monday, August 01, 2022
      30253AJC10175238Monday, August 01, 2022
      30253AJC70403227Monday, August 01, 2022
      30253AJC60614045Monday, August 01, 2022
      30253AJC50642527Monday, August 01, 2022
      30253AJC30576515Monday, August 01, 2022
      30253AJC60848377Monday, August 01, 2022