Forum Discussion

bijuphilipose's avatar
bijuphilipose
Frequent Visitor
5 years ago

Help with a measure

Hi All,

 

Need help in creating a DAX. I have three tables. Date, Table A, Table B.

 

We need to find out the subscriber who has left from two table. Now we count the subsciber id if the close date is is not null. In this scenario the subscriber must be in Table A (So count the ID in Table A) and then look when they have left which can either come from Table A or Table B. So we counted 

measure1=Count(Table A ID), userelationship datekey, table A clodedate key= 4

Measure2=Count(Table A ID), userelationship datekey, table B clodedate key= 4

So IN this case it becomes =4+4=8, however it should be 4 only.

We want to count the ID in Table which has either a close date in A or B.

 

In table A we have 4 of them.

 

5 Replies

    • bijuphilipose's avatar
      bijuphilipose
      Frequent Visitor

      Thanks for reply!

       

      IN my case I only want the id from Table A and there close dates from A or B. The table B can have more ID in there (a common table does not works). Now, I need to check any ID in Table A has a close date in A or B. My date table is linked to closed date of Table A.

  • ERD's avatar
    ERD
    Icon for Community Champion rankCommunity Champion

    Hello bijuphilipose ,

    From what I've got from your explanation your task is to get number of subscribers from table A that have close date either in table A or table B.

    1. Create a relation between your 2 tables on Subscriber ID column.

    2. Your measure:

    #Subscribers = 
    COUNTX(
        FILTER(
            TableA, 
            NOT(ISBLANK(TableA[Close Date])) || NOT(ISBLANK(RELATED(TableB[Close Date])))
        ), 
        TableA[S_ID]
    )
    • bijuphilipose's avatar
      bijuphilipose
      Frequent Visitor

      Thanks! The issue is the dates are present in both the tables sometimes. I am linking my date dim to the close date of the Table A and close date of Table B and Table A and B is alo joined on sub id's. As we need this data to be shown monthly the date slicer is required. Now I need to llok at the sub id in Table and and find if there is a close dat in A or B. So if a date is present in table A then I should ignore the date in Table B. I hope not sounding unfair in explaining it. 

       

      • ERD's avatar
        ERD
        Icon for Community Champion rankCommunity Champion

        It does not matter whether the dates are present in 2 tables or in one of them. If the date is present in one table or in both tables, it will still count as one. || - OR operator.