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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.