In PowerBI, is it possible two filters or slicers on two different tables such that I can filter either table or both tables and joining the data in the display?
create table person(
id int not null,
name char(30) not null,
grp char(1) not null)
create table time(
person_id int not null,
state char(10) not null,
date datetime not null,
hours int not null)
go
insert person values (1,'PersonA1','A')
insert person values (2,'PersonA2','A')
insert person values (3,'PersonA3','A')
insert person values (4,'PersonB1','B')
insert person values (5,'PersonB2','B')
insert person values (6,'PersonB3','B')
insert time values(1,'Work','2020-02-01',8)
insert time values(2,'Work','2020-02-02',8)
insert time values(1,'Vacation','2020-03-01',8)
insert time values(1,'Sick','2020-03-02',8)
insert time values(3,'Work','2020-03-04',8)
insert time values(4,'Work','2020-02-01',8)
insert time values(2,'Sick','2020-02-02',8)
insert time values(1,'Vacation','2020-03-01',8)
insert time values(2,'Sick','2020-03-02',8)
insert time values(2,'Work','2020-03-04',8)
insert time values(4,'Vacation','2020-02-01',8)
insert time values(5,'Work','2020-02-02',8)
insert time values(1,'Vacation','2020-03-01',8)
insert time values(2,'Sick','2020-03-02',8)
insert time values(3,'Work','2020-03-04',8)
Where in PowerBI, I want to show the following version of a table displayed. Here I am using Pivoted Column on the time table and using managed relationship to join to outputs into table format:
No filters
| person_id | id | name | grp | Sick | Vacation | Work |
|-------------|------|----------|-------|--------|------------|--------|
| 0 | 1 | PersonA1 | A | 0 | 0 | 0 |
| 1 | 2 | PersonA2 | A | 8 | 24 | 8 |
| 2 | 3 | PersonA3 | A | 24 | 0 | 16 |
| 3 | 4 | PersonB1 | B | 0 | 0 | 16 |
| 4 | 5 | PersonB2 | B | 0 | 8 | 8 |
| 5 | 6 | PersonB3 | B | 0 | 0 | 8 |
Add timeslicer or filter for date less than 2020-03-01
| person_id | id | name | grp | Sick | Vacation | Work |
|-------------|------|----------|-------|--------|------------|--------|
| 0 | 1 | PersonA1 | A | 0 | 0 | 0 |
| 1 | 2 | PersonA2 | A | 0 | 0 | 8 |
| 2 | 3 | PersonA3 | A | 8 | 0 | 8 |
| 3 | 4 | PersonB1 | B | 0 | 0 | 0 |
| 4 | 5 | PersonB2 | B | 0 | 8 | 8 |
| 5 | 6 | PersonB3 | B | 0 | 0 | 8 |
Add timeslicer or filter date for greater than 2020-03-01
| person_id | id | name | grp | Sick | Vacation | Work |
|-------------|------|----------|-------|--------|------------|--------|
| 0 | 1 | PersonA1 | A | 0 | 0 | 0 |
| 1 | 2 | PersonA2 | A | 8 | 24 | 0 |
| 2 | 3 | PersonA3 | A | 16 | 0 | 8 |
| 3 | 4 | PersonB1 | B | 0 | 0 | 16 |
| 4 | 5 | PersonB2 | B | 0 | 0 | 0 |
| 5 | 6 | PersonB3 | B | 0 | 0 | 0 |
Along with a filter on grp to show combinations of A and B or just A or B.
Using two filters like, Grp = A and date < 2020-03-01
filter
| person_id | id | name | grp | Sick | Vacation | Work |
|-------------|------|----------|-------|--------|------------|--------|
| 0 | 1 | PersonA1 | A | 0 | 0 | 0 |
| 1 | 2 | PersonA2 | A | 0 | 0 | 8 |
| 2 | 3 | PersonA3 | A | 8 | 0 | 8 |
Or, Grp = B and date > 2020-03-1
filter
| person_id | id | name | grp | Sick | Vacation | Work |
|-------------|------|----------|-------|--------|------------|--------|
| 3 | 4 | PersonB1 | B | 0 | 0 | 16 |
| 4 | 5 | PersonB2 | B | 0 | 0 | 0 |
| 5 | 6 | PersonB3 | B | 0 | 0 | 0 |
Or any combination of the two filters?