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
irnm8dn
Post Prodigy
Post Prodigy

Highlight Area in Data Visualization for Emphasis - Please Help!

In the simple visualization below, I am hoping to emphasize a portion of the timeline, the last 3 months for instance, to emphasize a specific time period of focus, but also connecting the relevancy to earlier months.

 

So for instance, October through June may be a subtle color, while July - September would be emphasized with an alternative (brighter) color.

 

Anybody have a recommendation how to do this from a technique perspective?  I am looking for a solution that can create the contrasting colors as the data changes...i.e. Highlight the last 3 mos, as opposed to highlight Jul, Aug, Sept if a conditional formatting is the recommended approach.

 

Thanks in advance.

 

Capture.JPG

 

1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi @irnm8dn ,

 

one approach would be to create to different measures and have them both in the same chart. 

 

As the DATEADD-function only accepts columns as input, I prefer to create a year-month number in my date table like this:

YearMonthNumber =
 ( YEAR ( Date[Date] ) - 2016 ) * 12
    + MONTH ( Date[Date] )

 

Your last 3 months-measure would when then look like this

Last 3 months =
VAR currentYearMontNumber =
    ( YEAR ( TODAY () ) - 2016 ) * 12
        + MONTH ( TODAY () )
RETURN
    CALCULATE (
        SUM ( 'Sales table'[Sales] );
        FILTER ( 'Date'; 'Date'[YearMonthNumber] > currentYearMontNumber - 3 )
    )

 

and the other months like this:

Other months = 
VAR currentYearMontNumber =
    ( YEAR ( TODAY () ) - 2016 ) * 12
        + MONTH ( TODAY () )
RETURN
    CALCULATE (
        SUM ( 'Sales table'[Sales] );
        FILTER ( 'Date'; 'Date'[YearMonthNumber] <= currentYearMontNumber - 3 )
    )

 

Then add both measures to a chart and it will  look somethink like this

Highlight Area in Data Visualization for Emphasis.PNG

 

example 

 

Cheers,
Sturla


If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

View solution in original post

1 REPLY 1
sturlaws
Resident Rockstar
Resident Rockstar

Hi @irnm8dn ,

 

one approach would be to create to different measures and have them both in the same chart. 

 

As the DATEADD-function only accepts columns as input, I prefer to create a year-month number in my date table like this:

YearMonthNumber =
 ( YEAR ( Date[Date] ) - 2016 ) * 12
    + MONTH ( Date[Date] )

 

Your last 3 months-measure would when then look like this

Last 3 months =
VAR currentYearMontNumber =
    ( YEAR ( TODAY () ) - 2016 ) * 12
        + MONTH ( TODAY () )
RETURN
    CALCULATE (
        SUM ( 'Sales table'[Sales] );
        FILTER ( 'Date'; 'Date'[YearMonthNumber] > currentYearMontNumber - 3 )
    )

 

and the other months like this:

Other months = 
VAR currentYearMontNumber =
    ( YEAR ( TODAY () ) - 2016 ) * 12
        + MONTH ( TODAY () )
RETURN
    CALCULATE (
        SUM ( 'Sales table'[Sales] );
        FILTER ( 'Date'; 'Date'[YearMonthNumber] <= currentYearMontNumber - 3 )
    )

 

Then add both measures to a chart and it will  look somethink like this

Highlight Area in Data Visualization for Emphasis.PNG

 

example 

 

Cheers,
Sturla


If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

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.