Forum Discussion

swasim's avatar
swasim
Helper I
2 years ago

DAX Measure for Conditional Color for Sparklines (SVG format)

Hi ,

 

Need help from experts , my client requirements

1) Draw a Sparkline using SVG  (Was able to get done)

2) Based on selected Date Filter , Sparkline should be charted for last 4 quarters. (Was able to get done)

3) Client wants to change Line color using  Linear Gradient based on the condition (Result Field )(I am having difficulty and need help)

 

If Value of Result is good  then  "#178757"  --green
If Value of Result is Bad then "#D71e28"   --red
if Value of Result is Aver then "#FFD100"  --Yellow
 
Attached the actual PBIX file and data for your reference. Can someone help here , having difficulty is drawing Line colors.
 
 
 
 

7 Replies

    • swasim's avatar
      swasim
      Helper I

      Yes , i dont know . Th Gradients i just copied from internet and i dont know how to resolve.  how do we pass to the PBI sparkline based on condition. 

      I dont want this hardcoding. Line color should be based on the condition in the excel.

       

      <stop stop-color='green' offset='0' />
              <stop stop-color='yellow' offset='50%' />
              <stop stop-color='red' offset='1' />

       

      Its based on the color from excel. Already based on the condition the color coding is in the excel.

       

      • lbendlin's avatar
        lbendlin
        Super User

        Your conditions change over time. That means you cannot use lines for the coloring, you would need to use single dots and color these accordingly.