Forum Discussion

Budman's avatar
Budman
Frequent Visitor
5 years ago
Solved

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
 
 

3 Replies

  • 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?

    • Budman's avatar
      Budman
      Frequent Visitor

      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!