Forum Discussion
ReadTheIron
5 years agoHelper III
Count Occurrences Since Date
I have two tables, one which records Assets and Repair Date, the other Assets and Failure Date. They're joined by a one-to-many relationship on Assets.
I want to add a column to Table1 that counts the number of failures that occur after the repair date, resulting in something like this:
I suspect this is quite simple, but I'm new to DAX and haven't been able to figure it out on my own. Any help appreciated!
you can create relationship between two tables and create a column
Column = if(ISBLANK(Table1[Repair Date]),0,COUNTX(FILTER(RELATEDTABLE(Table2),'Table1'[Repair Date]<='Table2'[Failure Date]),'Table2'[Failure Date])+0)pls see the attachment below
3 Replies
- ryan_mayuSuper User
you can create relationship between two tables and create a column
Column = if(ISBLANK(Table1[Repair Date]),0,COUNTX(FILTER(RELATEDTABLE(Table2),'Table1'[Repair Date]<='Table2'[Failure Date]),'Table2'[Failure Date])+0)pls see the attachment below
- ReadTheIronHelper III
Thank you! That works perfectly - and now I know how to do it for next time 😀
- ryan_mayuSuper User
you are welcome