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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
AlanP514
Post Patron
Post Patron

Dynamic Week

AlanP514_2-1691731440896.png

 

 

Hi 
I have one Scenario,
I wanted to create one calculated column for Matrix Table

Scenario : Slected Year 2023 Current year
Current Week (32)
I wanted to return Week Column numbers from Current Week to next 25 weeks (6 months)
if its 33 week as current week number table should start from 33 and next 25 weeks

Note : It should not populate anything if user select any other year, it should populate if its current year 
i have attached the excel image as expected output 
Hoping Best Solutions for this above post




2 REPLIES 2
ThxAlot
Super User
Super User

Simple enough

25wk.pbix

 

ThxAlot_0-1691741795439.png

 



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



johnyip
Solution Sage
Solution Sage

@AlanP514 

I cannot create what exactly tou expected, the below will create some similar output.

 

1. I simulate a table Slicer_selection which acts as the available selection of year in the slicer.

johnyip_0-1691740182464.png

 

2. Create a calculated table as below.

 

Dynamic Table = 
VAR t = {
(YEAR(TODAY()),WEEKNUM(TODAY(),21),YEAR(TODAY())),
(YEAR(TODAY()+7),WEEKNUM(TODAY()+7,21),YEAR(TODAY())),
(YEAR(TODAY()+7*2),WEEKNUM(TODAY()+7*2,21),YEAR(TODAY())),
(YEAR(TODAY()+7*3),WEEKNUM(TODAY()+7*3,21),YEAR(TODAY())),
(YEAR(TODAY()+7*4),WEEKNUM(TODAY()+7*4,21),YEAR(TODAY())),
(YEAR(TODAY()+7*5),WEEKNUM(TODAY()+7*5,21),YEAR(TODAY())),
(YEAR(TODAY()+7*6),WEEKNUM(TODAY()+7*6,21),YEAR(TODAY())),
(YEAR(TODAY()+7*7),WEEKNUM(TODAY()+7*7,21),YEAR(TODAY())),
(YEAR(TODAY()+7*8),WEEKNUM(TODAY()+7*8,21),YEAR(TODAY())),
(YEAR(TODAY()+7*9),WEEKNUM(TODAY()+7*9,21),YEAR(TODAY())),
(YEAR(TODAY()+7*10),WEEKNUM(TODAY()+7*10,21),YEAR(TODAY())),
(YEAR(TODAY()+7*11),WEEKNUM(TODAY()+7*11,21),YEAR(TODAY())),
(YEAR(TODAY()+7*12),WEEKNUM(TODAY()+7*12,21),YEAR(TODAY())),
(YEAR(TODAY()+7*13),WEEKNUM(TODAY()+7*13,21),YEAR(TODAY())),
(YEAR(TODAY()+7*14),WEEKNUM(TODAY()+7*14,21),YEAR(TODAY())),
(YEAR(TODAY()+7*15),WEEKNUM(TODAY()+7*15,21),YEAR(TODAY())),
(YEAR(TODAY()+7*16),WEEKNUM(TODAY()+7*16,21),YEAR(TODAY())),
(YEAR(TODAY()+7*17),WEEKNUM(TODAY()+7*17,21),YEAR(TODAY())),
(YEAR(TODAY()+7*18),WEEKNUM(TODAY()+7*18,21),YEAR(TODAY())),
(YEAR(TODAY()+7*19),WEEKNUM(TODAY()+7*19,21),YEAR(TODAY())),
(YEAR(TODAY()+7*20),WEEKNUM(TODAY()+7*20,21),YEAR(TODAY())),
(YEAR(TODAY()+7*21),WEEKNUM(TODAY()+7*21,21),YEAR(TODAY())),
(YEAR(TODAY()+7*22),WEEKNUM(TODAY()+7*22,21),YEAR(TODAY())),
(YEAR(TODAY()+7*23),WEEKNUM(TODAY()+7*23,21),YEAR(TODAY())),
(YEAR(TODAY()+7*24),WEEKNUM(TODAY()+7*24,21),YEAR(TODAY())),
(YEAR(TODAY()+7*25),WEEKNUM(TODAY()+7*25,21),YEAR(TODAY()))
    }
RETURN
SELECTCOLUMNS(t,"Year",[Value1],"Week",[Value2],"CurrentYear",[Value3])

 

 

3. Create a many-to-one relationship between the two tables as below.

johnyip_1-1691740298506.png

 

4. Build a matrix using [Year] and [Week] from Dynamic Table, and the slicer using [Year] from Slicer_selection.

johnyip_2-1691740406659.png

You will then come up with the above. Selection of year other than current year will yield nothing for the matrix.

You may need to refresh weekly for the dymnamic table to update with the correct week numbers.



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.