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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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.

 

image.png

 
2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

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"

image.png

View solution in original post

Mariusz
Community Champion
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


 

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Thanks guys!! Both solutions work.

Mariusz
Community Champion
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
Community Champion
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


 

Mariusz
Community Champion
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
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
Not applicable

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

Anonymous
Not applicable

Unfortunately I can only select my own created measures in this formula, but it should still be relevant. Doesn't work however.

 

Target Value = CALCULATE(SELECTEDVALUE('Target'[Target]),FILTER(DateTable,NOT(ISBLANK(Average cost]))))
Anonymous
Not applicable

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"

image.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.