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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Select 1 date and take 2 weeks

Hi,

 

I have this meassure: Week Start Date = BASE1415[FinActTran]-WEEKDAY(BASE1415[FinActTran],2) +1

that is generating the start week date from a specific date for example for example Jun 6, 2022, so now I need to take 2 weeks, i.e: 

 

Selecting Jun 6, 2022 -> Chart should show data of the week Jun 6, 2022 and Jun 13, 2022

 

Any idea?

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could create a flag measure as follows:

flag =
IF (
    DATEDIFF ( MAX ( 'Date'[Date] ), MAX ( 'Table'[Date] ), WEEK ) = 0
        && MAX ( 'Table'[Date] ) >= MAX ( 'Date'[Date] ),
    1,
    IF (
        DATEDIFF ( MAX ( 'Date'[Date] ), MAX ( 'Table'[Date] ), WEEK ) = 1
            && WEEKDAY ( MAX ( 'Table'[Date] ), 1 ) <= WEEKDAY ( MAX ( 'Date'[Date] ), 1 ),
        1,
        0
    )
)

The final output is shown below:

vyalanwumsft_0-1655110101668.png


Best Regards,
Community Support Team _ Yalan Wu
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

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could create a flag measure as follows:

flag =
IF (
    DATEDIFF ( MAX ( 'Date'[Date] ), MAX ( 'Table'[Date] ), WEEK ) = 0
        && MAX ( 'Table'[Date] ) >= MAX ( 'Date'[Date] ),
    1,
    IF (
        DATEDIFF ( MAX ( 'Date'[Date] ), MAX ( 'Table'[Date] ), WEEK ) = 1
            && WEEKDAY ( MAX ( 'Table'[Date] ), 1 ) <= WEEKDAY ( MAX ( 'Date'[Date] ), 1 ),
        1,
        0
    )
)

The final output is shown below:

vyalanwumsft_0-1655110101668.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

VahidDM
Super User
Super User

Hi @Anonymous 

 

Check this link, might be helpful:
https://www.vahiddm.com/post/weekly-time-intelligence-dax

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

All logo

LinkedIn | Twitter | Blog | YouTube 
FIFA World Cup - Medal Records 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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