cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
kster45 Frequent Visitor
Frequent Visitor

Measure to always filter back to start of a specific day of the week

Hi,

 

I am trying to create a column for my report that would calculate always to the previous thursday at 19:30 pm

 

For the past seven days i used this but i want it to go only until thursday, even if its a friday

 

CurProdWeek = DIVIDE(CALCULATE(SUM(Primary[Value]), Primary[Time] > today()-7), CALCULATE(SUM(Primary[HoursInPeriod]), Primary[Time] > today()-7))*100

 

The calculation for what I need works except I dont know how to filter to only the previous Thursday at 19:30. What I set up also needs to be dynamic, so every week when someone opens it up its correct.

 

Also need another column to do the previous week which would be ending the previous Thursday at 19:30 and begining the thursday before that one at 19:30

 

Any help would be greatly appreciated.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Measure to always filter back to start of a specific day of the week

@kster45,

 

You may refer to the DAX below.

Measure =
VAR d =
    TODAY ()
VAR n =
    WEEKDAY ( d )
RETURN
    d - n
        + 5
        - IF ( n > 5, 0, 7 )
        + TIME ( 19, 30, 0 )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 REPLY 1
Community Support Team
Community Support Team

Re: Measure to always filter back to start of a specific day of the week

@kster45,

 

You may refer to the DAX below.

Measure =
VAR d =
    TODAY ()
VAR n =
    WEEKDAY ( d )
RETURN
    d - n
        + 5
        - IF ( n > 5, 0, 7 )
        + TIME ( 19, 30, 0 )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.