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
Fossil1974
Frequent Visitor

Showing x-axis reference lines only when filter is selected

I have the following problem:

 

I want to display in a line chart different dates (DD/MM/YYYY) using x-axis reference lines. The visual shows three measures over a period of time which you can filter for a specific event (filter named "LeadSourceDetail") on the left side.

 

Please find the below screenshot for your reference:

2022-08-18 13_15_36-Truck_Evaluation_FN - Power BI Desktop.png

I am using three reference lines to display the exact date for the specific event (middle reference lines) an two other reference lines to display the date +3 month after (right hand reference line) and -3 month before (left hand reference line) the exact event date.

 

When I filter for a specific event ("LeadSouceDetail") the visual displays the right dates for the three reference lines as you can see in the first screenshot above.

 

But when I do not apply the filter, the visual displays wrong dates for the reference lines (picking the dates of the very first event in the dataset), as you can see in the second screenshot below:

2022-08-18 13_14_42-Truck_Evaluation_FN - Power BI Desktop.png

 

I know that you can write a measure to display nothing in a visual when a filter is not applied, but this works only in relation with measures. Since the reference lines are not based on measures, I wonder if there is a way to not show the reference lines if nothing is selected in the filter but still showing the measures ?

 

In addition, it would be extremely useful not to show the reference lines when multiple events are selected in the filter, as this would also show the wrong dates for the reference line in the visual.

2 REPLIES 2
amitchandak
Super User
Super User

@Fossil1974 , In case of X-axis and y-axis constant line , you uase a measure using fx option

 

You can have a measure like

 

if( calculate(isfiltered(Table[Lead source details]), allselected()) , #date(2022,10,01), blank())

Sorry, but I do not understand your idea. Could you elaborate further about your idea? Thanks !

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.