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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
BBIUser
Helper IV
Helper IV

Dynamic text value showing past few weeks

Hi,

 

I have column 'Week-Year' with records such as 15-2018, 16-2018, .............29-2018. I want to create an expression and might use it as a dynamic text "past _____ weeks". Lets say the starting week is 15-2018 and current week running is 29-2018, the result set should show 14. i.e., "past 14 weeks".

 

No 'Date' realted tables are available in my table.

 

What DAX should I use to get this result set? Do I need to split the column Week and Year and then create DAX?

 

Thanks!

1 ACCEPTED SOLUTION

Hi @BBIUser,

 

You could create the calculated column with the formula 1 and create measure with formula 2.

 

1. V_Weeks = LEFT('Table1'[Week-Year],2)
2. Measure = "Past"& MAX('Table1'[V_Weeks])-MIN('Table1'[V_Weeks])&"weeks"

Here is the output.

 

Capture.PNG

 

If you still need help, please share some data sample and your desired output so that we could help further on it.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
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

4 REPLIES 4
Anonymous
Not applicable

You can use formula like

V_Weeks=Left(Week-Year)

V_Diff=max(V_Week)-main(V_Week)

Thanks for the reply @Anonymous. Having trouble with these expressions.

Is V_Weeks a calculated Column and V_Diff a calculated Measure?

Hi @BBIUser,

 

You could create the calculated column with the formula 1 and create measure with formula 2.

 

1. V_Weeks = LEFT('Table1'[Week-Year],2)
2. Measure = "Past"& MAX('Table1'[V_Weeks])-MIN('Table1'[V_Weeks])&"weeks"

Here is the output.

 

Capture.PNG

 

If you still need help, please share some data sample and your desired output so that we could help further on it.

 

Best  Regards,

Cherry

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

Neat. It worked well. Thanks for the Solution @v-piga-msft.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.