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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
arobinson
Frequent Visitor

If Statement to a VAR

I am working through building a table and will have a few different columns with variables that will be Date dependant. 

 

Anyway to shrink up this formula or make it  faster? 

 

Date =
IF (AND ( Goals[Week] >= DATE ( 2021, 1, 3 ), Goals[Week] <= DATE ( 2021, 1, 9 ) ),1,
IF (AND ( Goals[Week] >= DATE ( 2021, 1, 10 ), Goals[Week] <= DATE ( 2021, 1, 16 ) ),2,
IF (AND ( Goals[Week] >= DATE ( 2021, 1, 17 ), Goals[Week] <= DATE ( 2021, 1, 23 ) ),3)))
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

How about Date = WEEKNUM ( Goals[Week] ) - 1?

View solution in original post

1 REPLY 1
AlexisOlson
Super User
Super User

How about Date = WEEKNUM ( Goals[Week] ) - 1?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

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.