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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Dynamic Text Box based on relative date filter

Hello again,

 

Im looking to make a dynamic text box indicating what the dates are for the current filter. For example, I have a last calendar week relative data filter. I need the text box to say: The current week displayed is from: 3/22/2020-3/28/2020. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

According to your description, it sounds like your table date range not completed. If this is a case, I think you need to do some calculation to expand them to full week records.

Measure =
VAR _min =
    MINX ( VALUES ( 'Table'[Date] ), [Date] )
VAR _max =
    MAXX ( VALUES ( 'Table'[Date] ), [Date] )
VAR _minCal =
    _min - WEEKDAY ( _min, 2 ) + 1
VAR _maxCal =
    _max
        + ( 7 - WEEKDAY ( _max, 2 ) )
RETURN
    _minCal & "-" & _maxCal

Regards,

Xiaoxin Sheng

View solution in original post

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

You should be able to do something like:

Measure = "The current week displayed is from: " & MIN('Date'[Date]) & "-" & MAX('Date'[Date])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

Thanks for your help. That measure returns: 3/24/2020-3/27/2020

EDIT:

I think I know why this is displaying like this. Although my relative date filters are set for 3-22-2020 to 3-28-2020 the only invoices I have in that period are in between the date range above. I'm wondering how to work around this. 

Anonymous
Not applicable

HI @Anonymous,

According to your description, it sounds like your table date range not completed. If this is a case, I think you need to do some calculation to expand them to full week records.

Measure =
VAR _min =
    MINX ( VALUES ( 'Table'[Date] ), [Date] )
VAR _max =
    MAXX ( VALUES ( 'Table'[Date] ), [Date] )
VAR _minCal =
    _min - WEEKDAY ( _min, 2 ) + 1
VAR _maxCal =
    _max
        + ( 7 - WEEKDAY ( _max, 2 ) )
RETURN
    _minCal & "-" & _maxCal

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

@Anonymous 

Your solution works for my specific requirement when the +1 is deleted and (7- WEEKDAY(_max,2) is changed to (7- WEEKDAY (_max,1). Thanks!

You are selecting Min/max from Calendar table as Suggested by @Greg_Deckler or from your data table?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@Anonymous - Right, as @amitchandak says, you should be using the same table and column for your min/max as in your slicer. If you are using the Date column from your fact table, try creating a separate Calendar/Date table using CALENDARAUTO or CALENDAR and then creating a relationship on your Date columns.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors