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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
anwilkins
Resolver II
Resolver II

How to calculate 21st birtdate based on Date of Birth coumn then set a reminder flag

I am creating a report that shows patients in a program. I want to indicate who is about to age out on their 21st birthday. I have two questions:

What's the DAX to create a column showing the date my clients turn 21

AND, how to set a flag 31 days prior to that date that turns the name record yellow

 

Ex: but in my report I dont need to display the Flag Date, I just need to use that date but I cant get conditional formating to work on the entire row. 

anwilkins_1-1654806671212.png

 

 

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @anwilkins 

 

Use this DAX code to create a measure, and download the attached file:

21 Birthday = 
VAR _DOB =
    MAX ( 'Table'[DOB] )
VAR _21B =
    DATE ( YEAR ( _DOB ) + 21, MONTH ( _DOB ), DAY ( _DOB ) ) - 31
RETURN
    IF (
        TODAY () >= _21B
            && TODAY ()
                < DATE ( YEAR ( _DOB ) + 21, MONTH ( _DOB ), DAY ( _DOB ) ),
        "Yellow"
    )

 

Output:

VahidDM_0-1654823647255.png

 



 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

All logo

LinkedIn | Twitter | Blog | YouTube 

 

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @anwilkins 

 

Use this DAX code to create a measure, and download the attached file:

21 Birthday = 
VAR _DOB =
    MAX ( 'Table'[DOB] )
VAR _21B =
    DATE ( YEAR ( _DOB ) + 21, MONTH ( _DOB ), DAY ( _DOB ) ) - 31
RETURN
    IF (
        TODAY () >= _21B
            && TODAY ()
                < DATE ( YEAR ( _DOB ) + 21, MONTH ( _DOB ), DAY ( _DOB ) ),
        "Yellow"
    )

 

Output:

VahidDM_0-1654823647255.png

 



 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

All logo

LinkedIn | Twitter | Blog | YouTube 

 

Sorry to say this did not work. Looking at the file I can't tell how to apply the measure and I'd like the entire row highlighted not just that cell. I can do cell highlights with no DAX using conditional formatting if necessary.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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