Forum Discussion
IvanS
Helper V
3 years agoCompare 2 columns from different tables without relationship
Hi guys,
I have small problem with performing DAX calculation between 2 tables that have no active relationship.
Here is example tables with the red highlighted column:
Table: FACT_Tasks
| ID (unique values) | RelatedTo_ID (Task can be related to several tables - such as Case, Product, Location) |
| 111 | 1 |
| 112 | 3 |
| 113 | 5 |
| 114 | 1 |
| 115 | 8 |
Table: FACT_Cases
| ID (unique values) | Nr. of tasks (calculated column) |
| 1 | 2 |
| 2 | 0 |
| 3 | 1 |
I tried following function but it is taking previous Case ID and I am not aware how to compare it with the current row.
CALCULATE(
COUNT(FACT_Tasks[Id]), FACT_Tasks[RelatedTo_Id] = EARLIER(FACT_Cases[Id]))
Any help is much appreciated!
Thank you
Ivan
IvanS , a new column in FACT_Cases
CALCULATE( COUNT(FACT_Tasks[Id]),filter(FACT_Tasks, FACT_Tasks[RelatedTo_Id] = FACT_Cases[Id]))
1 Reply
- amitchandak
Super User
IvanS , a new column in FACT_Cases
CALCULATE( COUNT(FACT_Tasks[Id]),filter(FACT_Tasks, FACT_Tasks[RelatedTo_Id] = FACT_Cases[Id]))