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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
ericsara
Helper I
Helper I

X-Axis Constant Line value as conditional formatting does not how on line graph

I have a line graph that shows % on the Y axis and dates on the X.

The graph has a static filter on it that is set to only show dates where the week offset is greater than or equal to -52 (i.e. showing a year of data).

I want to show have a line on the X-Axis that shows where the week offset is equal to -4 (i.e. 4 weeks ago).

I created the following Measure

 

Week End Date 4 Weeks Ago = 

VAR OneWeekEndSelected = HASONEVALUE(Dates[WeekEnding])
VAR SelectedWeekOffset = IF(OneWeekEndSelected=TRUE,VALUES(Dates[WeekOffset]),99) 
VAR WeekOffSet4WeeksAgo = SelectedWeekOffset-3

VAR Date4WeeksAgo = LOOKUPVALUE(Dates[WeekEnding],Dates[WeekOffset],WeekOffSet4WeeksAgo)

return Date4WeeksAgo

 

When I look at thie value in a Card it is correct. 

When I add this to the X-Axis Constant Line as a Conditional Fomat, it does not show. 

If I manually type in the date and do not use the Conditional Fomat optoin the lines shows as I want. However as the data grows week on week then next week the fixed date will be 5 weeks and not 4 weeks ago. 

 

Can anyone advise why the line is not showing when I use a method?

 

Thanks, 

1 REPLY 1
lbendlin
Super User
Super User

You can try to add a measure that computes the -4, and add it to the chart.

 

Please provide sanitized sample data that fully covers your issue. I cannot help you without usable sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive. I cannot use screenshots of your source data.
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors