cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

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
Community Support

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

@Anonymous,

 

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.

View solution in original post

1 REPLY 1
Community Support
Community Support

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

@Anonymous,

 

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.

View solution in original post

Helpful resources

Announcements
‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors