Forum Discussion
How to make a column relationship conditional based on data in another column
Hi Community!
I have a table with relational date slicers (i.e. last week, last month, etc.) that has two relationships with a primary data table called SecurityIncidents, which is a Microsoft Sentinel table built on a Log Workspace. The table I need to relate is external and has low fildelity data identifiers and sometimes, may have duplicates that should be aggregated but only if they are in the same date. How can I make that table relationship coniditional on another column match such as date?
For example, the following table has no primary identifier with the SecurityIncidents table in my log workspace, because in this dataset, the column of ID is an external number. The only data that can be related is the column for Summary, for which is not unique and may have occurred at other dates. There is the Time Created (I have created a DateCreated column for simplicity sake of only date) but it is not unique, since other Summary of alerts in rows happen that do not have the same Summary or content, but have the same date.
External Table (the only two columns that we can match on in the SecurityIncidents are Summary and TimeCreated)
Severity ID Summary Count Category Status Time Created
| Low | MSS0138052 | Alert for suspicious activity No1 | 118 | Collection | Resolved by customer | 2024-02-19T21:03:34UTC |
| Medium | MSS0135931 | Alert for suspicious activity No2 | 1 | Defense Evasion | Resolved by customer | 2024-02-07T15:17:06UTC |
| High | MSS0134928 | Alert for suspicious activity No3 | 1 | Execution | Resolved by customer | 2024-02-01T21:33:46UTC |
Hello RUExperienc3d,
Can you please try the following:
1. Ensure Date Consistency (For both tables, you could create a calculated column like this)
DateCreated = DATEVALUE(Format([Time Created], "YYYY-MM-DD"))2. Create a Composite Key (For both the external table and the SecurityIncidents table, add a new calculated column)
CompositeKey = [Summary] & " | " & FORMAT([DateCreated], "YYYY-MM-DD")3. Use DAX for Conditional Relationships
Aggregated Measure = SUMX( FILTER( ExternalTable, CONTAINS(SecurityIncidents, SecurityIncidents[CompositeKey], ExternalTable[CompositeKey]) ), ExternalTable[SomeValueColumn] // Replace )4. Addressing Duplicates
Aggregated External Table = SUMMARIZE( ExternalTable, [CompositeKey], "AggregatedValue", SUM(ExternalTable[SomeValueColumn]) // Adjust as needed )Hope this helps!
1 Reply
- Sahir_MaharajSuper User
Hello RUExperienc3d,
Can you please try the following:
1. Ensure Date Consistency (For both tables, you could create a calculated column like this)
DateCreated = DATEVALUE(Format([Time Created], "YYYY-MM-DD"))2. Create a Composite Key (For both the external table and the SecurityIncidents table, add a new calculated column)
CompositeKey = [Summary] & " | " & FORMAT([DateCreated], "YYYY-MM-DD")3. Use DAX for Conditional Relationships
Aggregated Measure = SUMX( FILTER( ExternalTable, CONTAINS(SecurityIncidents, SecurityIncidents[CompositeKey], ExternalTable[CompositeKey]) ), ExternalTable[SomeValueColumn] // Replace )4. Addressing Duplicates
Aggregated External Table = SUMMARIZE( ExternalTable, [CompositeKey], "AggregatedValue", SUM(ExternalTable[SomeValueColumn]) // Adjust as needed )Hope this helps!