Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi Team,
I need a help in filtering a visual to show only the active users between the From and To Date. Below is how my data looks like. I have slicer from StartDate and EndDate.
When a user selects the date from these Slicers, the table visual should only show the employees who were active during this time.
Im trying to achieve the last column marked in Red below.
the criteria would be,
1. when a user has startdate and end date within the selected period
2. when a user has startdate or end date within the selected period
3. when a user has startdate before the startdateslicer and enddate is blank
In the above scenarios, the condition turns to true and I like all the users in the table visuals where the condition is true.
Kinldy help on achieving this please.
StartDate Slicer | EndDate Slicer |
01/01/2022 | 04/25/2022 |
Id | StartDate | EndDate | Active? |
10001 | 04/14/2011 | 06/24/2011 | No |
10002 | 04/26/2022 | No | |
10003 | 04/04/2022 | Yes | |
10004 | 04/20/2022 | Yes | |
10005 | 04/24/2022 | Yes | |
10006 | 07/31/2011 | Yes | |
10007 | 11/10/2011 | 12/08/2011 | No |
10008 | 03/15/2022 | 03/15/2022 | Yes |
10009 | 11/24/2021 | 12/28/2021 | No |
10010 | 04/14/2011 | 04/26/2023 | Yes |
10011 | 03/15/2022 | Yes | |
10012 | 05/19/2012 | 05/19/2024 | Yes |
10013 | 04/14/2011 | Yes | |
10014 | 08/14/2020 | 12/18/2021 | No |
10015 | 03/15/2022 | Yes |
Solved! Go to Solution.
See if the below measure works:
Measure =
VAR FirstDay = CALCULATE(
MIN('DateTable'[Date]),
ALLSELECTED('DateTable'[Date])
)
VAR LastDay = CALCULATE(
MAX('DateTable'[Date]),
ALLSELECTED('DateTable'[Date])
)
Return
SWITCH(TRUE(),
FirstDay < MAX(MainTable[StartDate]) && Max(MainTable[EndDate])<LastDay,"Yes",
FirstDay < MAX(MainTable[StartDate]) && Max(MainTable[EndDate]) = BLANK(),"Yes",
"No")
Hi,
Try this measure it shoul work
See if the below measure works:
Measure =
VAR FirstDay = CALCULATE(
MIN('DateTable'[Date]),
ALLSELECTED('DateTable'[Date])
)
VAR LastDay = CALCULATE(
MAX('DateTable'[Date]),
ALLSELECTED('DateTable'[Date])
)
Return
SWITCH(TRUE(),
FirstDay < MAX(MainTable[StartDate]) && Max(MainTable[EndDate])<LastDay,"Yes",
FirstDay < MAX(MainTable[StartDate]) && Max(MainTable[EndDate]) = BLANK(),"Yes",
"No")
@PC2790 Thank you. with a little tweak I was able to get to the result withe approach you have provided. Thank you very much
@amitchandak Hi Amit thank you very much for the link.
Ratherthan count, Im looking for a column Indicator to show the active users for the selected period.
Current Employees = CALCULATE(COUNTx(FILTER(Employee,Employee[Start Date]<=max('Date'[Date]) && (ISBLANK(Employee[End Date]) || Employee[End Date]>max('Date'[Date]))),(Employee[Employee Id ])),CROSSFILTER(Employee[Start Date],'Date'[Date],None))
How can I modify this to show as a column instead of measure? Please help.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
68 | |
60 | |
51 | |
36 | |
35 |
User | Count |
---|---|
84 | |
71 | |
56 | |
45 | |
43 |