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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
NPC
Helper I
Helper I

Moving Target

Hello,

I need to create a taget that increases automatically by 200 each week on Thursdays. The target will be diplayed on a card. The code below works but I want to avoid hard coding dates because then I'll have to manually change the date at the beggining on next year.
 
Thanks for your help. Below is what I came up with.
 
Moving Target =
 
VAR WK45 = 200*13
VAR WK46 = 200*14
VAR WK47 = 200*15
VAR WK48 = 200*16
VAR WK49 = 200*17
VAR WK50 = 200*18
VAR WK51 = 200*19

 

return
IF(TODAY()>=DATE(2021,11,11) && TODAY()<=DATE(2021,11,17), WK45,
IF(TODAY()>=DATE(2021,11,18) && TODAY()<=DATE(2021,11,24), WK46,
IF(TODAY()>=DATE(2021,11,25) && TODAY()<=DATE(2021,12,01), WK47,
IF(TODAY()>=DATE(2021,12,02) && TODAY()<=DATE(2021,12,08), WK48,
IF(TODAY()>=DATE(2021,12,09) && TODAY()<=DATE(2021,12,15), WK49,
IF(TODAY()>=DATE(2021,12,16) && TODAY()<=DATE(2021,12,22), WK50,
IF(TODAY()>=DATE(2021,12,23) && TODAY()<=DATE(2021,12,31), WK51)))))))
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Try something like this:

Target = 200 * ( 13 + ROUNDDOWN ( ( TODAY() - DATE ( 2021, 11, 11 ) ) / 7, 0 ) )

This adds the number of weeks beyond the initial 11/11/2021 to 13 before multiplying by 200.

View solution in original post

2 REPLIES 2
NPC
Helper I
Helper I

Much appreciated!

AlexisOlson
Super User
Super User

Try something like this:

Target = 200 * ( 13 + ROUNDDOWN ( ( TODAY() - DATE ( 2021, 11, 11 ) ) / 7, 0 ) )

This adds the number of weeks beyond the initial 11/11/2021 to 13 before multiplying by 200.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors
Top Kudoed Authors