Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello,
I'm currently looking to filter out sales data that falls between Friday at 5pm and Monday at 4am. Is there a DAX that can accomplish this?
Solved! Go to Solution.
Hi @bmccaslin please check this
Create a calculated column
Hi @bmccaslin,
Thank you for reaching out to the Microsoft fabric community forum. Thank you @techies, for your inputs on this issue.
Calculated Column:
IsWeekendSalesWindow =
VAR WeekdayNumber = WEEKDAY(Sales[SalesDateTime], 2) -- Monday=1, Sunday=7
VAR TimeOnly = TIME(HOUR(Sales[SalesDateTime]), MINUTE(Sales[SalesDateTime]), SECOND(Sales[SalesDateTime]))
RETURN
SWITCH(TRUE(),
-- Friday after 5 PM
WeekdayNumber = 5 && TimeOnly >= TIME(17,0,0), TRUE,
-- Saturday anytime
WeekdayNumber = 6, TRUE,
-- Sunday anytime
WeekdayNumber = 7, TRUE,
-- Monday before 4 AM
WeekdayNumber = 1 && TimeOnly < TIME(4,0,0), TRUE,
FALSE
)
Dax Measure:
SalesOutsideWeekendWindow =
CALCULATE(
SUM(Sales[SalesAmount]),
FILTER(
Sales,
NOT (
VAR WeekdayNumber = WEEKDAY(Sales[SalesDateTime], 2)
VAR TimeOnly = TIME(HOUR(Sales[SalesDateTime]), MINUTE(Sales[SalesDateTime]), SECOND(Sales[SalesDateTime]))
RETURN
SWITCH(TRUE(),
WeekdayNumber = 5 && TimeOnly >= TIME(17,0,0),
TRUE(),
WeekdayNumber = 6,
TRUE(),
WeekdayNumber = 7,
TRUE(),
WeekdayNumber = 1 && TimeOnly < TIME(4,0,0),
TRUE(),
FALSE()
)
)
)
)
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
Hi @bmccaslin,
Thank you for reaching out to the Microsoft fabric community forum. Thank you @techies, for your inputs on this issue.
Calculated Column:
IsWeekendSalesWindow =
VAR WeekdayNumber = WEEKDAY(Sales[SalesDateTime], 2) -- Monday=1, Sunday=7
VAR TimeOnly = TIME(HOUR(Sales[SalesDateTime]), MINUTE(Sales[SalesDateTime]), SECOND(Sales[SalesDateTime]))
RETURN
SWITCH(TRUE(),
-- Friday after 5 PM
WeekdayNumber = 5 && TimeOnly >= TIME(17,0,0), TRUE,
-- Saturday anytime
WeekdayNumber = 6, TRUE,
-- Sunday anytime
WeekdayNumber = 7, TRUE,
-- Monday before 4 AM
WeekdayNumber = 1 && TimeOnly < TIME(4,0,0), TRUE,
FALSE
)
Dax Measure:
SalesOutsideWeekendWindow =
CALCULATE(
SUM(Sales[SalesAmount]),
FILTER(
Sales,
NOT (
VAR WeekdayNumber = WEEKDAY(Sales[SalesDateTime], 2)
VAR TimeOnly = TIME(HOUR(Sales[SalesDateTime]), MINUTE(Sales[SalesDateTime]), SECOND(Sales[SalesDateTime]))
RETURN
SWITCH(TRUE(),
WeekdayNumber = 5 && TimeOnly >= TIME(17,0,0),
TRUE(),
WeekdayNumber = 6,
TRUE(),
WeekdayNumber = 7,
TRUE(),
WeekdayNumber = 1 && TimeOnly < TIME(4,0,0),
TRUE(),
FALSE()
)
)
)
)
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
Hi @bmccaslin,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @bmccaslin,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hi @bmccaslin,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
Hi @bmccaslin please check this
Create a calculated column
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 |
---|---|
14 | |
10 | |
10 | |
9 | |
9 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |