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
AnandNamburi
Helper III
Helper III

how to display current week and prior week dynamically?

Hi All,

 

I have a requirement to display current week sales and prior week sales in two pages(1 page for current week sles and other for prior week sales) and the values should change dynamically with our date.

 

Example:

Current week as of today is 6/Dec to 12/Dec and if week changes it need to change automatically 13/Dec to 19/Dec.

 

Anyone help me how we can acheive this.

 

Thanks,

Anand

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AnandNamburi,

There are a few different ways to achieve this. Perhaps the simplest one is to build your report page, duplicate it, and set page-level filters on each of the pages using the date column and "relative date filtering" as shown below:

 

prior_week.PNGcurrent_week.PNG

Alternatively you can create calculated columns to determine whether a date is within the current or prior calendar week and use that as a filter. You can do this by for example creating a single column like below, which will return whether the value is within the current or prior week, and will leave the cell blank if it falls outside both those categories:

 

week_category =
IF(
    WEEKNUM( 'example_table'[Date].[Date] ) = WEEKNUM( TODAY() ),
    "Current week",
    IF(
        WEEKNUM( 'example_table'[Date].[Date] ) = WEEKNUM( TODAY() ) - 1,
        "Prior week"
    )
)

 

Another option is to create two boolean columns, one returning TRUE if the date is in the current week, and another returning TRUE if the date is in the prior week:

 

is_current_week =
IF(
    WEEKNUM( 'example_table'[Date].[Date] ) = WEEKNUM( TODAY() ),
    TRUE(),
    FALSE()
)

 

is_prior_week =
IF(
    WEEKNUM( 'example_table'[Date].[Date] ) = WEEKNUM( TODAY() ) - 1,
    TRUE(),
    FALSE()
)

 

I hope this helps - have a great weekend!

View solution in original post

2 REPLIES 2
AnandNamburi
Helper III
Helper III

It works Thank you so much...

Anonymous
Not applicable

Hi @AnandNamburi,

There are a few different ways to achieve this. Perhaps the simplest one is to build your report page, duplicate it, and set page-level filters on each of the pages using the date column and "relative date filtering" as shown below:

 

prior_week.PNGcurrent_week.PNG

Alternatively you can create calculated columns to determine whether a date is within the current or prior calendar week and use that as a filter. You can do this by for example creating a single column like below, which will return whether the value is within the current or prior week, and will leave the cell blank if it falls outside both those categories:

 

week_category =
IF(
    WEEKNUM( 'example_table'[Date].[Date] ) = WEEKNUM( TODAY() ),
    "Current week",
    IF(
        WEEKNUM( 'example_table'[Date].[Date] ) = WEEKNUM( TODAY() ) - 1,
        "Prior week"
    )
)

 

Another option is to create two boolean columns, one returning TRUE if the date is in the current week, and another returning TRUE if the date is in the prior week:

 

is_current_week =
IF(
    WEEKNUM( 'example_table'[Date].[Date] ) = WEEKNUM( TODAY() ),
    TRUE(),
    FALSE()
)

 

is_prior_week =
IF(
    WEEKNUM( 'example_table'[Date].[Date] ) = WEEKNUM( TODAY() ) - 1,
    TRUE(),
    FALSE()
)

 

I hope this helps - have a great weekend!

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.