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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Filip_analyst
Regular Visitor

DAX measure - fixed line between two dates

Hello everyone,

 

Is there any way to force DAX to calculate a constatnt line (1) between two dates? Chart below:

Filip_analyst_3-1673433861042.png

 

 

My current measure:

Filip_analyst_4-1673433880749.png

*Measure "Test1" is added to chart as line

Every time  I play around with filter context (DIM_DATE) I receive a value 1 across all dates.
Thanks for any help 🙂

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

HI @Filip_analyst 
Please try

Test2 =
VAR date1 =
    MAX ( DIM_DATE[DATE] )
VAR date2 =
    DATE ( 2022, 01, 05 )
VAR date2 =
    DATE ( 2022, 06, 10 )
RETURN
    IF ( date1 >= date2 && date1 <= date3, 1 )

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

HI @Filip_analyst 
Please try

Test2 =
VAR date1 =
    MAX ( DIM_DATE[DATE] )
VAR date2 =
    DATE ( 2022, 01, 05 )
VAR date2 =
    DATE ( 2022, 06, 10 )
RETURN
    IF ( date1 >= date2 && date1 <= date3, 1 )

Works as expected, thank you @tamerj1  ! 🙂

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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