Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Show only relevant data in graph

Hi guys,

I created a dynamic constant line in my report through the use of a parameter.

However, when I plot this in a graph, it shows the value for all my dates (I have a datetable), instead of just the relevant ones.

 

Is there any way I can do this?

 

Thanks in advance.

 

 
  • Anonymous's avatar
    Anonymous
    6 years ago

    What I meant is to use the filter pane, and in this case I am guessing, you want to filter the empty values of Average Cost

     

    use either both "Is not blank" and "is not 0" or just one of them depending on your returned values. If 0 is actually valid value, then use just "is not blank"

  • Hi Anonymous 

     

    This should work as well

    Target = 
    IF( 
        NOT ISEMPTY( 'TableWhereTheAVGCostIs' ), 
        SELECTEDVALUE( 'Target'[Target] ) 
    )

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn


     

8 Replies

  • Mariusz's avatar
    Mariusz
    Community Champion

    Hi Anonymous 

     

    How do you calculate you Target as it seems that this is the cause of the issue?

     

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn


      

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Mariusz ,

       

      The default of the parameter is the following:

      Target Value = SELECTEDVALUE('Target'[Target])

       

      I've tried the following aswell, thinking I could only show the target for the relevant dates, but that also doesn't work.

      Target Value = CALCULATE(SELECTEDVALUE('Target'[Target]),FILTER(DateTable,[Average cost]>0))

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Try filtering the measure "is not blank" or "is not 0" if you've set blank() = 0, in the filter pane

  • Mariusz's avatar
    Mariusz
    Community Champion

    Hi Anonymous 

     

    Try this.

    Target = 
    VAR __min = MIN( 'TableWhereTheAVGCostIs'[Date] ) 
    VAR __max = MAX( 'TableWhereTheAVGCostIs'[Date] )
    RETURN
    CALCULATE( 
        IF( 
            NOT ISEMPTY( 'TableWhereTheAVGCostIs' ), 
            SELECTEDVALUE( 'Target'[Target] ) 
        ),
        'DateTable'[Date] <= __min,
        'DateTable'[Date] >= __max
    )
    

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn

     

    • Mariusz's avatar
      Mariusz
      Community Champion

      Hi Anonymous 

       

      This should work as well

      Target = 
      IF( 
          NOT ISEMPTY( 'TableWhereTheAVGCostIs' ), 
          SELECTEDVALUE( 'Target'[Target] ) 
      )

       

      Best Regards,
      Mariusz

      If this post helps, then please consider Accepting it as the solution.

      Please feel free to connect with me.
      LinkedIn


       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks guys!! Both solutions work.