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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
saipawar
Helper IV
Helper IV

Dynamic text field based on current date

Hi, 

 

I want to display "currently you are in <Phase 1>, 22 days to go for the event"

- Currently means today's date

- <Phase 1> will be picked from a lookup up below

- countdown wrt to Phase 3 date

PhaseDate 
Phase 1Monday, June 12,2023 
Phase 2Tuesday, August 1,2023 
Phase 3Tuesday, October 17, 2023

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @saipawar ,

 

Thanks for the reply from @PhilipTreacy , like he said, I do not quite understand your needs, I can only do what I can to help you.

 

Based on the table you provided, I am not sure why today is part of phase 1 and why it is 22 days.

 

My understanding is this:

 

First determine the phase you currently belong to based on today is date, then calculate the number of days between today and Phase 3.

 

If today is date is earlier than Phase 1 then it belongs to Phase 1, if today is date is earlier than Phase 2 then it belongs to Phase 2, if today is date is earlier than Phase 3 then it belongs to Phase 3.

 

I modified the example data as follows:

Phase

Date

Phase 1

6/12/2024

Phase 2

8/1/2024

Phase 3

10/17/2024

 

First, create a measure to calculate the phase to which the current date belongs:

 

Current Phase =
VAR TodayDate =
    TODAY ()
RETURN
    IF (
        TodayDate
            < CALCULATE (
                MAX ( 'Phases'[Date] ),
                FILTER ( 'Phases', 'Phases'[Phase] = "Phase 1" )
            ),
        "Phase 1",
        IF (
            TodayDate
                < CALCULATE (
                    MAX ( 'Phases'[Date] ),
                    FILTER ( 'Phases', 'Phases'[Phase] = "Phase 2" )
                ),
            "Phase 2",
            "Phase 3"
        )
    )

 

 

Next, calculate the date interval between today and the Phase 3 date:

 

Countdown to Phase 3 =
VAR Phase3Date =
    CALCULATE (
        MAX ( 'Phases'[Date] ),
        FILTER ( 'Phases', 'Phases'[Phase] = "Phase 3" )
    )
RETURN
    DATEDIFF ( TODAY (), Phase3Date, DAY )

 

 

Then, apply dynamic text formatting, which will change dynamically based on today is date:

 

Dynamic Text =
"Currently, you are in " & [Current Phase] & ", "
    & ABS ( [Countdown to Phase 3] ) & " days to go for the event."

 

 

Finally, the Dynamic Text is dragged to the card visual object for display, and the page visualization looks like the following:

vhuijieymsft_0-1714373040333.png

 

The pbix file is attached.

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @saipawar ,

 

Thanks for the reply from @PhilipTreacy , like he said, I do not quite understand your needs, I can only do what I can to help you.

 

Based on the table you provided, I am not sure why today is part of phase 1 and why it is 22 days.

 

My understanding is this:

 

First determine the phase you currently belong to based on today is date, then calculate the number of days between today and Phase 3.

 

If today is date is earlier than Phase 1 then it belongs to Phase 1, if today is date is earlier than Phase 2 then it belongs to Phase 2, if today is date is earlier than Phase 3 then it belongs to Phase 3.

 

I modified the example data as follows:

Phase

Date

Phase 1

6/12/2024

Phase 2

8/1/2024

Phase 3

10/17/2024

 

First, create a measure to calculate the phase to which the current date belongs:

 

Current Phase =
VAR TodayDate =
    TODAY ()
RETURN
    IF (
        TodayDate
            < CALCULATE (
                MAX ( 'Phases'[Date] ),
                FILTER ( 'Phases', 'Phases'[Phase] = "Phase 1" )
            ),
        "Phase 1",
        IF (
            TodayDate
                < CALCULATE (
                    MAX ( 'Phases'[Date] ),
                    FILTER ( 'Phases', 'Phases'[Phase] = "Phase 2" )
                ),
            "Phase 2",
            "Phase 3"
        )
    )

 

 

Next, calculate the date interval between today and the Phase 3 date:

 

Countdown to Phase 3 =
VAR Phase3Date =
    CALCULATE (
        MAX ( 'Phases'[Date] ),
        FILTER ( 'Phases', 'Phases'[Phase] = "Phase 3" )
    )
RETURN
    DATEDIFF ( TODAY (), Phase3Date, DAY )

 

 

Then, apply dynamic text formatting, which will change dynamically based on today is date:

 

Dynamic Text =
"Currently, you are in " & [Current Phase] & ", "
    & ABS ( [Countdown to Phase 3] ) & " days to go for the event."

 

 

Finally, the Dynamic Text is dragged to the card visual object for display, and the page visualization looks like the following:

vhuijieymsft_0-1714373040333.png

 

The pbix file is attached.

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

PhilipTreacy
Super User
Super User

Hi @saipawar 

 

Your request is too vague.

 

How do we know what phase has been seelcted?

 

Where do you want this information displayed?  In a card visual?

 

If the countodwn is wrt to the Phase3 date, and you are in Phase 1, based on your table, there would be more than 22 days to go.

 

Please provide more information and answers to the above.

 

Regards

 

Phil

 

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.