Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bijuphilipose
Frequent Visitor

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.

 

bijuphilipose_0-1616632388576.png

bijuphilipose_1-1616632649138.png

5 REPLIES 5
ERD
Super User
Super User

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]
)

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

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. 

 

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.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

amitchandak
Super User
Super User

@bijuphilipose , You need to have a common subscribe table , with that you can run a formula like

refer: https://www.youtube.com/watch?v=Bkf35Roman8

 

countx(filter(summarize(Suscriber, Suscriber[Suscriber], "_1", Count(Table1[Close Date])+0, "_2", Count(Table2[Close Date])+0), _1 >0 && _2>0),[Suscriber])

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors