Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
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
v-chuncz-msft
Community Support
Community Support

@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
v-chuncz-msft
Community Support
Community Support

@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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.