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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Budman
Frequent Visitor

Line chart - dynamic target or constant line issues

Hi All, 

 

First, thanks to all the contributors for the help in this community.  I can usually find a solution here but not today.

 

I am trying to create a line chart of water quality results over time where the user selects the testing sites and the analyte (or type of water quality test).  Depending on the analyte selected I want to show the target line as a straight line across the date range selected.  I've stored the targets for each analyte in a separate joined table. 

 

After learning that I cannot use the legend field, I created measures for each of the sites using:

TPJ = AVERAGEX(FILTER( Tablename, Tablename[SiteName] = "TPJ"), [Result])
 
I can add these measures and my target value field to my line chart values and everything is pretty good except....
The legend shows all sites even if the user does not have that field selected so my colors for each of the sites are no longer consistent with my other visualizations.
 
Any suggestions on a better approach or a work around?
 
Many thanks,
Bud
 
IssueFigure.JPG
 
1 ACCEPTED SOLUTION
Budman
Frequent Visitor

3 REPLIES 3
Budman
Frequent Visitor

This video helped me get what I needed....

https://www.youtube.com/watch?v=OIGGrrnMIgk

 

amitchandak
Super User
Super User

@Budman , what is measure used in visual. Does not seem like the above mentioned one.

 

Can you share that. Does is have +0 or some if condition to handle blank?

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

That is the measure I am using - one for each site.  But I think I see where you are going.  I will try to find some examples because my DAX skills are terrible.  I welcome any suggestions.  Thank you!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.