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,
Hoping someone can help as i have been stuck for 3 days now!
I am trying to create a table which shows this weeks data next to the previous weeks data. Using a slicer we want to be able to change the date so the table will update. The issue i have is we need to account for multiple date filters.
So the requirements are -
StartDate needs to be before or equal to date selected
EndDate needs to be after or equal to date selected
CancelledDate needs to be after or equal to date selected OR blank
UserStatus must equal active
I did think i could maybe make userelationship work and tested it with just the StartDate but it doesn't like it
I have tried so many variations through help from articles and looking through the community but no luck! Any help would be greatly appreciated!
Solved! Go to Solution.
Hi @PowerPuff36
Assume your UserTable is like below and you have a Calendar table, you don't need to create a relationship between them.
Put date column from Calendar table into a slicer for users to pick a date. Then you could create below measures to get the count on the selected date and on the date 7 days ago (previous week). You can use && (AND) and || (OR) to combine multiple filters.
This Week Count =
VAR __selectedDate = SELECTEDVALUE ( 'Calendar'[Date] )
RETURN
COUNTX (
FILTER (
UserTable,
UserTable[StartDate] <= __selectedDate
&& UserTable[EndDate] >= __selectedDate
&& (
UserTable[CancelledDate] >= __selectedDate
|| ISBLANK ( UserTable[CancelledDate] )
)
&& UserTable[UserStatus] = "Active"
),
UserTable[UserId]
)
Previous Week Count =
VAR __selectedDate = SELECTEDVALUE ( 'Calendar'[Date] ) - 7
RETURN
COUNTX (
FILTER (
UserTable,
UserTable[StartDate] <= __selectedDate
&& UserTable[EndDate] >= __selectedDate
&& (
UserTable[CancelledDate] >= __selectedDate
|| ISBLANK ( UserTable[CancelledDate] )
)
&& UserTable[UserStatus] = "Active"
),
UserTable[UserId]
)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @PowerPuff36
Assume your UserTable is like below and you have a Calendar table, you don't need to create a relationship between them.
Put date column from Calendar table into a slicer for users to pick a date. Then you could create below measures to get the count on the selected date and on the date 7 days ago (previous week). You can use && (AND) and || (OR) to combine multiple filters.
This Week Count =
VAR __selectedDate = SELECTEDVALUE ( 'Calendar'[Date] )
RETURN
COUNTX (
FILTER (
UserTable,
UserTable[StartDate] <= __selectedDate
&& UserTable[EndDate] >= __selectedDate
&& (
UserTable[CancelledDate] >= __selectedDate
|| ISBLANK ( UserTable[CancelledDate] )
)
&& UserTable[UserStatus] = "Active"
),
UserTable[UserId]
)
Previous Week Count =
VAR __selectedDate = SELECTEDVALUE ( 'Calendar'[Date] ) - 7
RETURN
COUNTX (
FILTER (
UserTable,
UserTable[StartDate] <= __selectedDate
&& UserTable[EndDate] >= __selectedDate
&& (
UserTable[CancelledDate] >= __selectedDate
|| ISBLANK ( UserTable[CancelledDate] )
)
&& UserTable[UserStatus] = "Active"
),
UserTable[UserId]
)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. Please show the expected outcome.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
167 | |
117 | |
63 | |
57 | |
50 |