Milos Todosijevic
Milos Todosijevic

Reputation: 143

Count distinct values of column in one table filtering other table in tabular model DAX

I'm new in DAX. I have dimension Tasks. I have fact table FactEntries. In fact table we can have for example multiple rows per one task. How could I create measure that will count distinct tasks in table FactEntries, but only those tasks which are completed (column [Task Is Complited][bit] - values 1 or 0; from table Tasks). Could you help me? Thanks!

Upvotes: 0

Views: 1665

Answers (2)

Hamza Lahbabi
Hamza Lahbabi

Reputation: 39

You can distinctcount the nameof the task instead by key task, and instead of calculatetable you can use a simple filter Tasks Completed:= CALCULATE(DISTINCTCOUNT('Entries'[Task name]),filter(Task, Task[Task Is Completed]<>False()))

Upvotes: 0

Milos Todosijevic
Milos Todosijevic

Reputation: 143

I found a solution:

Tasks Completed:= CALCULATE(DISTINCTCOUNT('Entries'[Task Key]),CALCULATETABLE(Task, Task[Task Is Completed]<>False()))

Upvotes: 0

Related Questions