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
AnnaML
Frequent Visitor

Show Latest and future Weeks

Hello, 

I have a bar chart showing hours per week actuals vs target. Now It shows latest 20 weeks, i want the chart to show the latest 20 weeks but also the future 4 weeks. This in order to see what the target level are at in the coming weeks. 

Can someone help me? 
Is it possible to show both latest and future weeks? 

Thanks for the support, 

 

 

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

Hi @AnnaML ,

 

You could create  a new table with Week column(with Year*100+WeekNum format) for slicer,and use the following formula to create a measure:

Week =
YEAR ( [Date] ) * 100
    + WEEKNUM ( [Date], 1 )
Measure =
IF (
    MAX ( 'Table'[Week] )
        >= SELECTEDVALUE ( ForSlicer[Week] ) - 20
        && MAX ( 'Table'[Week] )
            <= SELECTEDVALUE ( ForSlicer[Week] ) + 4,
    1,
    0
)

Then apply it to visual-level filter,set as "is 1" like this:

3.2.3.1.last and future.PNG

Please take a look at the pbix file here.

 

Best Regards,
Eyelyn Qin
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

3 REPLIES 3
v-eqin-msft
Community Support
Community Support

Hi @AnnaML ,

 

You could create  a new table with Week column(with Year*100+WeekNum format) for slicer,and use the following formula to create a measure:

Week =
YEAR ( [Date] ) * 100
    + WEEKNUM ( [Date], 1 )
Measure =
IF (
    MAX ( 'Table'[Week] )
        >= SELECTEDVALUE ( ForSlicer[Week] ) - 20
        && MAX ( 'Table'[Week] )
            <= SELECTEDVALUE ( ForSlicer[Week] ) + 4,
    1,
    0
)

Then apply it to visual-level filter,set as "is 1" like this:

3.2.3.1.last and future.PNG

Please take a look at the pbix file here.

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much for your time and effort! It helped me! 

amitchandak
Super User
Super User

@AnnaML , Create column like these in you date table and filter on that

 

Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1

 

Week Type = Switch( True(),
[start week]>=Today()-150 &&
[start week]<=Today()+ 28 ,"Last 20 + next 4 Week" ,
[Week Name]
)

 

filter Last 20 + next 4 Week

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.