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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
brookesmoore
Frequent Visitor

Help with changing the text within a text box depending on the date/quarter/year filters

Hello All,

 

I have a series of cards aligned in a row displaying the sums of various revenue types. Each revenue type has its own column in the table and is linked to a date spanning from 1/1/2022 to today. 

Below each card is a text box showing a percentage that denotes the portion of the revenue that goes to the client (text is "98%").

Below each text box I have another series of cards showing a measure of Revenue Type * Percentage giving the total.

 

On 2/1/2023, a couple of the percentages were changed (98% to 94%), thus requiring a new calculation to get the total due to the client for any transactions from 2/1/2023 and on.

 

I have a slicer with a Date Slider, a slicer with 2022 and 2023 as tiles, and a slicer with 4 quarters as tiles. 

 

Im looking to see if there is a way to have the percentages in the text boxes change depending on what date filters are being used on the page. For example, if the date range is before 2/1/23, I want the text to display "98%". If after 2/1/23, it should say "94%". If the date range includes dates from both before and after 2/1/23, I want the text box to display "98%/94%" (or just blank, i havent decided what will look better for this situation).

 

Is any of this possible? Any leads are greatly appreciated. Happy to provide additional info if needed. Thanks!

2 ACCEPTED SOLUTIONS
v-yiruan-msft
Community Support
Community Support

Hi @brookesmoore ,

You can follow the steps below to get it, please find the details in the attachment.

1. Create a measure as below

Measure = 
VAR _mindate =
    MIN ( 'Date'[Date] )
VAR _maxdate =
    MAX ( 'Date'[Date] )
RETURN
    IF (
        _maxdate < DATE ( 2023, 2, 1 ),
        0.98,
        IF ( _mindate >= DATE ( 2023, 2, 1 ), 0.94, BLANK () )
    )

2. Create a card visual to replace the textbox

yingyinr_1-1679290078949.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @brookesmoore ,

You can make a little adjustment on the measure as below, please find the details in the attachment.

Measure =
VAR _mindate =
    MIN ( 'Date'[Date] )
VAR _maxdate =
    MAX ( 'Date'[Date] )
RETURN
    IF (
        _maxdate < DATE ( 2023, 2, 1 ),
        0.98,
        IF ( _mindate >= DATE ( 2023, 2, 1 ), 0.94, "98%/94%" )
    )

vyiruanmsft_0-1680155162367.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hi @brookesmoore ,

You can follow the steps below to get it, please find the details in the attachment.

1. Create a measure as below

Measure = 
VAR _mindate =
    MIN ( 'Date'[Date] )
VAR _maxdate =
    MAX ( 'Date'[Date] )
RETURN
    IF (
        _maxdate < DATE ( 2023, 2, 1 ),
        0.98,
        IF ( _mindate >= DATE ( 2023, 2, 1 ), 0.94, BLANK () )
    )

2. Create a card visual to replace the textbox

yingyinr_1-1679290078949.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for your reply. This is working so far. 

 

I would like to see if there is a way to display the text "98%/94%" should the date range fall into both ranges (before or on 1/31/2023 and after or on 2/1/2023). Is this possible?

Hi @brookesmoore ,

You can make a little adjustment on the measure as below, please find the details in the attachment.

Measure =
VAR _mindate =
    MIN ( 'Date'[Date] )
VAR _maxdate =
    MAX ( 'Date'[Date] )
RETURN
    IF (
        _maxdate < DATE ( 2023, 2, 1 ),
        0.98,
        IF ( _mindate >= DATE ( 2023, 2, 1 ), 0.94, "98%/94%" )
    )

vyiruanmsft_0-1680155162367.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Works perfectly. Thank you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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