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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register 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 @Anonymous - 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
Anonymous
Not applicable

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 @Anonymous - 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
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

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