Forum Discussion
Nested IF statement?
So I was fiddling with the code today and tried every single variation of ISBLANK/COUNTROWS/II/&&/all the possible column names and table names, but nothing worked.
When I removed ‘City Images JPG Base 64’[Selected Image]) from the ISBLANK function, the whole image disappeared and it said “Fix this.” When I put it back in, it worked again. So the problem must be with the COUNTROWS function. If I take out COUNTROWS(‘City Images JPG Base 64’) altogether, it still works to the same degree.
Image =
var img =
IF([SelectedImage]="Canada" ||
COUNTROWS('City Images JPG Base 64')=0 && ISBLANK('City Images JPG Base 64'[SelectedImage]),
"data:image/jpeg;base64, "&
CONCATENATEX(FILTER
('City Images JPG Base 64',
'City Images JPG Base 64'[Name]="Canada.jpg"),'City Images JPG Base 64'[Pic],,'City Images JPG Base 64'[Index],ASC),
IF(
HASONEVALUE('City Images JPG Base 64'[Name]),
"data:image/jpg;base64, " &
CONCATENATEX
('City Images JPG Base 64',
'City Images JPG Base 64'[Pic],
,
'City Images JPG Base 64'[INDEX],ASC)
)
)
RETURN img
So then I actually removed the 4th line altogether (ISBLANK...) and the code worked the same as it did without that line!!