Forum Discussion
Finding unique and intersect values using DAX URGENTTT
- 2 years ago
Adjust the first measure djust the logic to focus exclusively on `col_id = 15`. We want to count unique `main_id` values where `kre_id = 84` for `col_id = 15`, ensuring these `main_id` values do not have any other `kre_id` values associated with them within `col_id = 15`.
Adjusted Measure 1: Unique `main_id` for `kre_id = 84` within `col_id = 15`
Unique Main ID for KreID 84 and ColID 15 =
VAR FilteredTable =
FILTER (
YourTable,
YourTable[col_id] = 15
)
VAR MainIDsWithKreID84 =
CALCULATETABLE (
VALUES (FilteredTable[main_id]),
FilteredTable[kre_id] = 84
)
VAR MainIDsWithSingleKreID =
FILTER (
MainIDsWithKreID84,
CALCULATE (
COUNTROWS (FilteredTable),
ALLEXCEPT (FilteredTable, FilteredTable[main_id])
) = 1
)
RETURN
COUNTROWS (MainIDsWithSingleKreID)
Adjust the first measure djust the logic to focus exclusively on `col_id = 15`. We want to count unique `main_id` values where `kre_id = 84` for `col_id = 15`, ensuring these `main_id` values do not have any other `kre_id` values associated with them within `col_id = 15`.
Adjusted Measure 1: Unique `main_id` for `kre_id = 84` within `col_id = 15`
Unique Main ID for KreID 84 and ColID 15 =
VAR FilteredTable =
FILTER (
YourTable,
YourTable[col_id] = 15
)
VAR MainIDsWithKreID84 =
CALCULATETABLE (
VALUES (FilteredTable[main_id]),
FilteredTable[kre_id] = 84
)
VAR MainIDsWithSingleKreID =
FILTER (
MainIDsWithKreID84,
CALCULATE (
COUNTROWS (FilteredTable),
ALLEXCEPT (FilteredTable, FilteredTable[main_id])
) = 1
)
RETURN
COUNTROWS (MainIDsWithSingleKreID)