March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi All... I have a requirement .
I have 2 tables. client table (client name) and fact table(effective date & Expiration date). I have to have a active today filter to find the active clients as of today. i.e if i select date as 18/12/2024 the result has to fetch me B & C from the below.
Hi @jostnachs
Thank you for reaching out to us on the Microsoft Fabric Community Forum
DateTable = CALENDAR(DATE(2020, 1, 1), DATE(2030, 12, 31))
We can adjust the date range as necessary.
Select Fact table create new measure
ActiveStatus_StaticDate = VAR SelectedDate = DATE(2024, 12, 18) -- Static date: 18/12/2024
RETURN
IF
(
MAX('FactTable'[EffectiveDate]) <= SelectedDate && MAX('FactTable'[ExpirationDate]) >= SelectedDate,
"Active",
"Inactive"
)
If this post was helpful, please give us Kudos and consider marking Accept as solution to assist other members in finding it more easily.
Thank you
Hi @jostnachs ,
To find the active clients based on the selected date in Power BI, you can create a calculated column or a measure. Here's how you can achieve this:
Load Your Tables:
Import the Client Table and Fact Table into Power BI.
Define a Date Slicer:
Add a date slicer to your report so users can select a specific date (e.g., 18/12/2024).
Create an "Active Today" Measure:
Use the following DAX measure to determine if a client is active on the selected date:
Active Clients =
VAR SelectedDate = MAX('Calendar'[Date]) -- Use a Date table or slicer for the selected date
RETURN
CALCULATE(
DISTINCTCOUNT(ClientTable[ClientName]),
FILTER(
FactTable,
FactTable[EffectiveDate] <= SelectedDate
&& FactTable[ExpirationDate] >= SelectedDate
)
)
Use the Measure in a Visual:
Add the Client Name from your Client Table into a table or matrix visual, and apply this measure as a filter:
Set the measure to "is not blank" or > 0 to filter only active clients.
Add a Date Slicer:
Add a slicer for the date column (e.g., from a Calendar table) to allow users to select the "active today" date.
OR
Alternative: Create a Calculated Column
If you prefer to filter directly in the Fact Table, you can create a calculated column in the Fact Table:
IsActive =
VAR SelectedDate = TODAY() -- Or a custom date from a slicer
RETURN
IF(
FactTable[EffectiveDate] <= SelectedDate
&& FactTable[ExpirationDate] >= SelectedDate,
1,
0
)
You can then filter the table where IsActive = 1.
Expected Outcome:
When the selected date is 18/12/2024, the result will include:
Let me know if you need help setting this up!
If I have resolved your question, please consider marking my post as a solution. Thank you!
A kudos is always appreciated—it helps acknowledge the effort and keeps the community thriving.
Hi @jostnachs
Use a disconnected dates table and create this measure:
Client by Time Period =
VAR StartDate =
MIN ( Dates[Date] )
VAR EndDate =
MAX ( Dates[Date] )
RETURN
COUNTROWS (
FILTER (
Client,
Client[EffectiveDate] <= EndDate
&& Client[ExpirationDate] >= StartDate
)
)
This will return more than 1 only in the dates when the expiraiton and effective dates overlap
Please see the attached pbix for details.
Note: moving forward, please use a sample that we can easily copy paste as table to excel and not an image.
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
86 | |
70 | |
51 |
User | Count |
---|---|
206 | |
150 | |
97 | |
78 | |
69 |