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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MPetramalo214
Helper I
Helper I

Two Measures to Draw One Line

Hi everyone, let me preface this by saying I'm not sure the requested feature is entirely possible.

 

What I'm trying to do is create two separate measures for a line chart.  I want the measure to check the last day of the dataset, and if we're meeting or above goal; it should draw the entire line.  Second measure does the same thing, just if we're below goal.

 

A couple important items that may help:

1) I'm tracking running sales and a running sales goal this looks something like

MPetramalo214_0-1641932956884.png

2) The last day of the mock dataset is 1/6/22

MPetramalo214_1-1641932982182.png

3) Here is what I'd envision the table looking like if the measures were working as intended.

Above Goal (as of 1/6):

MPetramalo214_2-1641933210090.png

Below Goal (as of 12/16):

MPetramalo214_3-1641933251794.png

 

Unfortunately, the way its currently calculating is

MPetramalo214_4-1641933310199.png

 

Measures to note:

 

Running Sales = 
CALCULATE(
    SUM(Sheet1[Sales Actual]),
    FILTER(
        ALLSELECTED(Sheet1[Date]),
        ISONORAFTER(Sheet1[Date], MAX(Sheet1[Date]), DESC)
    )
)

Running Goal = 
CALCULATE(
    SUM(Sheet1[Sales Goal]),
    FILTER(
        ALLSELECTED(Sheet1[Date]),
        ISONORAFTER(Sheet1[Date], MAX(Sheet1[Date]), DESC)
    )
)

Above Goal = 
IF([Running Sales] >= [Running Goal], [Running Sales], BLANK())

Below Goal = 
IF([Running Sales] < [Running Goal], [Running Sales], BLANK())

 

 

Any sort of guidance would be greatly appreciated.

3 REPLIES 3
v-kkf-msft
Community Support
Community Support

Hi @MPetramalo214 ,

 

Are you trying to show different colors on the same line, like this?

vkkfmsft_1-1642140534127.png

 

Currently Power BI does not support conditional formatting of the color of the line chart, you can suggest your idea here.

https://ideas.powerbi.com/ideas/idea/?ideaid=0671c26d-bd0e-43ad-b78c-bb097f2c54af 

 

Just as a workaround, you can try other visuals or superimpose two fold lines as follows.

Put the measures into the Values/Secondary values pane separately, then close the legend, set the color of [Above Goal] and [Running Sales] to the same, and turn on the "Series labels" option.

 

vkkfmsft_2-1642140598602.png

vkkfmsft_3-1642140633258.png

vkkfmsft_0-1642140512937.png

 

Then the final result will be:

 

vkkfmsft_4-1642140903521.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I'm not trying to get one line with two colors; I actually was trying to force one line to be conditional on if we're above goal on the max day we're filtered to, and the other to be conditional on if we're below goal. 

 

Which ever is true, would draw the line - and because its two measures, I can manually set the color of each.

 

All the following is being manually manipulated by me; but is how I would envision this working.  But I understand if this is not a feature yet.

 

Above Goal:

MPetramalo214_0-1642167278640.png

 

Below Goal:

MPetramalo214_1-1642167326088.png

 

The problem I am currently running into, is that instead of the entire series of dates being calculated by each measure; the measures are only calculating when that day is above/below goal:

MPetramalo214_2-1642167464231.png

 

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. Please show the expected outcome.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.