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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
danielllin
Helper I
Helper I

How to avoid display "Can't display the visual" when dataset is null (R visual)

Hi,
 
Canvas has one R visual and several slicers.
In some conditions, dataset will become empty,
so the R visual will show "can't display the visual". 
Is it possible display empty like other visuals , or show some messages to warning dataset is null, 
because showing "can't display the visual" looks more like a bug than dataset is null.

 

 未命名.png

 

 

 

Thanks in advance!
 
Daniell

6 REPLIES 6
cs_skit
Resolver IV
Resolver IV

Can you put some IF empty THEN 0 in your undlerlying variables for your R visual?

I'm a rookie of R language, this is how i tried,

but it still shows "Faceting variables must have at least one value"

how should i modify this code?

Thanks!

 

#dataset <- data.frame( cus_name, amt, year, rank)

if(is.null(dataset))
{
newrow = c("NoData", 1, 2000, 1)

dataset <- rbind(dataset, newrow)
}

I meant not in R but in the underlying data

make yure you always pass something

why is the dataset empty in the first place?

for example,  in some year, products' amount is all zero, so the rank will all become 1,

i write a code to identify is whole year's amount zero, if it's true then all rank is blank.

That's why the dataset is empty.

But if i keep zero, then all product will show up, the R visual will become more weird...

@danielllin

 

R visual can't display empty visual when populating BLANK() values, and re-assign new rows in R script will not work.

 

In this scenario, you have to assign a non-empty value field. I suggest you make the rank into -1 when whole year's amount is 0. And if you filter with TOP N rank slicer, it will definitely return all products.

 

Regards,

hi, thanks for your explanation,

 

I make the rank into -1 instead of blank, then all product will show up, the visual will become like this, 

it's the original situation which i tried to avoid....

If it's no way to avoid, i'll consider re-design the whole structure,

Thanks!

 

未命名.png

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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