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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

Blank line graph with time series data and only show data with slicer selection

Hello helpful community,

 

Given the speed at which Power BI updates are made, most of the previous posts on this are no longer helpful as they reference interfaces that do not exist at this time (such as parts of this https://www.mssqltips.com/sqlservertip/6850/power-bi-slicer-dynamic-visuals/)

 

Here is my situation: I have time-series data and want to show index-scores across time by country.

 

Therefore, X-axis=year, Y-axis=indexscore, Legend=country name. My slicer has "country". I would like a blank graph to show until I select a country. Unfortunately, after having tried numerous different types of filters including INT(ISFILTERED(Table[country])) then putting this measure into the visual's filter and doing the whole 'show items when the value is =1, apply filter... I cannot get any DAX to work.

 

Any insight onto how to get this to work? Do I need to include an "isfiltered" condition on "year" as well? I would prefer not to. I'd like to only have the user select a country in the slicer, and see the country's change in score over time.

 

Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks @v-rzhou-msft - for some reason, I could not get your solution to work. However, I connected with a colleague and here was the solution that worked for me in the end:

1. Create the measure for a "blank" line graph:

CountrySelected =
VAR CountrySliced =
CALCULATE(
    ISFILTERED('Table1'[Country]),
    ALLSELECTED('Table1'[Country])
)
RETURN
if(
    CountrySliced,
    SUM('Table'[China_Exposure_2]),
    BLANK()
)
 
2. Create a blank card (transparency set to zero) that instructs the reader to select a country in order to see data populated:
 
cardtext =
if( [CountrySelected],
    "",
    "Please select a country to populate this graph"
    )

View solution in original post

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous ,

 

I think this should be caused by you add [Country] into Legend Field. Here I suggest you to create an unrelated DimCountry table in your report.

DimCountry = 
VALUES(Sheet1[Country])

Relationship:

RicoZhou_0-1666859619352.png

Then try this measure.

Measure = 
VAR _SELECTION = VALUES(DimCountry[Country])
RETURN
IF(ISFILTERED(DimCountry[Country]),CALCULATE(SUM(Sheet1[Value]),FILTER(Sheet1,Sheet1[Country] in _SELECTION)),BLANK())

Result is as below.

By Default:

RicoZhou_1-1666859638551.png

Select Country in Slicer:

RicoZhou_2-1666859705514.png

 

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks @v-rzhou-msft - for some reason, I could not get your solution to work. However, I connected with a colleague and here was the solution that worked for me in the end:

1. Create the measure for a "blank" line graph:

CountrySelected =
VAR CountrySliced =
CALCULATE(
    ISFILTERED('Table1'[Country]),
    ALLSELECTED('Table1'[Country])
)
RETURN
if(
    CountrySliced,
    SUM('Table'[China_Exposure_2]),
    BLANK()
)
 
2. Create a blank card (transparency set to zero) that instructs the reader to select a country in order to see data populated:
 
cardtext =
if( [CountrySelected],
    "",
    "Please select a country to populate this graph"
    )

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

October NL Carousel

Fabric Community Update - October 2024

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