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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ajitsahoo8338
Helper III
Helper III

Need Help with this logic

Hello Everyone, I need help with this.

I have a date in my table, with dates ranging from 2019 to today. My requirement is to display Measure1 for dates from the previous Sunday to the previous Saturday, and Measure2 for all other dates.

How can I achieve this?

 

Thank You,
Ajit

1 REPLY 1
bhanu_gautam
Super User
Super User

@ajitsahoo8338 

Create a calculated column to identify the week range:
DAX
WeekRange =
VAR CurrentDate = 'Table'[Date]
VAR PreviousSunday =
IF(
WEEKDAY(TODAY(), 2) = 7,
TODAY() - 7,
TODAY() - WEEKDAY(TODAY(), 2)
)
VAR PreviousSaturday = PreviousSunday + 6

 

Create a measure to display Measure1 or Measure2 based on the week range:
DAX
DisplayMeasure =
IF(
MAX('Table'[WeekRange]) = "PreviousWeek",
[Measure1],
[Measure2]
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors