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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
johnerlandsson
Regular Visitor

Visualize data over different ranges

I have two queries

 

A

tsm_idvalue
2019-10-17 12:00:00P112
2019-10-17 12:10:00P111
2019-10-17 12:05:00P220

 

B

ts_startts_endtypem_id
2019-10-17 11:30:002019-10-17 12:30:00DirectP1
2019-10-17 12:30:002019-10-17 13:30:00IndirectP1

 

Table A & B m_id is a "many to many" relationship. I use it for filtering (single selection).

 

I want to visualize table A value by timestamp as a line chart. I want the charts background color to vary depending on table B type for that timestamp range. How do I accomplish this?

 

I don't know of a way of doing it using matplotlib.

I don't know any R.

I am new to Power Bi.

 

Is there a better way of visualizing this data?

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @johnerlandsson

 

Currently, we cannot set conditional formmating of the background in line chart. We can create a measure and use table visual to work around.

 

Measure = 
VAR ts =
    MAX ( A[ts] )
VAR mid =
    MAX ( A[m_id] )
VAR typ =
    CALCULATE (
        MAX ( B[type] ),
        FILTER ( B, B[ts_start] <= ts && B[ts_end] >= ts && B[m_id] = mid )
    )
RETURN
    IF ( typ = "Direct", "#FF0027", IF ( typ = "Indirect", "#0040FF", BLANK () ) )

Capture.PNG

 

Btw, we can use Line and clustered column chart to work around by a new measure.

Measure 3 = 
VAR ts =
    MAX ( A[ts] )
VAR mid =
    MAX ( A[m_id] )
VAR typ =
    CALCULATE (
        MAX ( B[type] ),
        FILTER ( B, B[ts_start] <= ts && B[ts_end] >= ts && B[m_id] = mid )
    )
RETURN
    IF ( typ = "Direct", 100, IF ( typ = "Indirect",200, BLANK () ) )

co.PNG

 

 

 

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

View solution in original post

1 REPLY 1
v-frfei-msft
Community Support
Community Support

Hi @johnerlandsson

 

Currently, we cannot set conditional formmating of the background in line chart. We can create a measure and use table visual to work around.

 

Measure = 
VAR ts =
    MAX ( A[ts] )
VAR mid =
    MAX ( A[m_id] )
VAR typ =
    CALCULATE (
        MAX ( B[type] ),
        FILTER ( B, B[ts_start] <= ts && B[ts_end] >= ts && B[m_id] = mid )
    )
RETURN
    IF ( typ = "Direct", "#FF0027", IF ( typ = "Indirect", "#0040FF", BLANK () ) )

Capture.PNG

 

Btw, we can use Line and clustered column chart to work around by a new measure.

Measure 3 = 
VAR ts =
    MAX ( A[ts] )
VAR mid =
    MAX ( A[m_id] )
VAR typ =
    CALCULATE (
        MAX ( B[type] ),
        FILTER ( B, B[ts_start] <= ts && B[ts_end] >= ts && B[m_id] = mid )
    )
RETURN
    IF ( typ = "Direct", 100, IF ( typ = "Indirect",200, BLANK () ) )

co.PNG

 

 

 

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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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