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

Blank deneb visual until slicer selected

Is it possible to set up a Deneb visual to be blank until a slicer is selected?

 

I have a measure that looks like this (is blank until a Country is selected in the slicer):

EventCountrySelected =
VAR CountrySliced2 =
CALCULATE(
    ISFILTERED('EVENTS TEST'[Country]),
    ALLSELECTED('EVENTS TEST'[Country])
)
RETURN
if(
    CountrySliced2,
    sum('EVENTS TEST'[Score_2]),
    BLANK()
)
 
It works just fine in a regular line graph in Power BI. My line graph is blank until I select a country from the slicer.
 
However, I'd like to use a Deneb custom visual I created (also a multi-line graph) as it is more layered/dynamic. It works as it should when I use my "Country" field. So, I tried replacing my "Country" field in deneb with the above measure, and I get a blank graph:
 
veronica_zappp_0-1669732253756.png

 

and when I selected a country in the slicer, it does update, but still doesn't show the country I selected:

 

veronica_zappp_1-1669732374803.png

 

Any tips on how to set the deneb visual to be blank until a country is selected? I double checked my code (see below), the new countryblank measure is all there in vega-lite. I tried using a card that becomes transparent when a slicer is selected but realized that won't work for me because the point of the deneb visual is to be interactive (vertical line on mouseover) and the card prevents me from using mouseover.

 

{
"data": {"name": "dataset"},
"width": 600,
"height": 500,
"layer": [
{
"encoding": {
"x": {"field": "Year_formatted", "type": "temporal", "title": "Years (YYYY)"},
"y": {"field": "Index Score", "type": "quantitative", "title": "Score"},
"color": {"field": "EventCountrySelected", "type": "nominal", "legend": null}
},
"layer": [
{"mark": "line"},
{
"params": [{
"name": "label",
"select": {
"type": "point",
"encodings": ["x"],
"nearest": true,
"on": "mouseover"
}
}],
"mark": "point",
"encoding": {
"opacity": {
"condition": {
"param": "label",
"empty": false,
"value": 1
},
"value": 0
}
}
}
]
},
{
"transform": [{"filter": {"param": "label", "empty": false}}],
"layer": [
{
"mark": {"type": "rule", "color": "gray"},
"encoding": {
"x": {"type": "temporal", "field": "Year_formatted", "aggregate": "min"}
}
},
{
"encoding": {
"text": {"type": "quantitative", "field": "Index Score"},
"x": {"type": "temporal", "field": "Year_formatted"},
"y": {"type": "quantitative", "field": "Index Score"}
},
"layer": [
{
"mark": {
"type": "text",
"stroke": "white",
"strokeWidth": 2,
"align": "left",
"dx": 5,
"dy": -5
}
},
{
"mark": {"type": "text", "align": "left", "dx": 5, "dy": -5},
"encoding": {
"color": {"type": "nominal", "field": "EventCountrySelected"}
}
}
]
}
]
},
{
"mark": {"type": "text", "align": "center", "fontWeight": "bold", "fontSize": 10, "dy": 15},
"encoding": {
"x": {
"field": "Year_formatted",
"type": "temporal"
},
"y": {
"field": "Index Score",
"type": "quantitative"
},
"text": {"field": "Event Name", "type": "nominal"},
"color": {"value": "black"}
}}
]
}

 

Thanks for the wisdom.

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @veronica_zappp ,

 

Please refer to these similar threads, hope these are helpful.
Solved: Visualisations blank until something selected in a...
Solved: Visual blank until filter selected
powerbi - Hide a visual until slicers are selected in power BI

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Sorry, this did not help.

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.