Forum Discussion
Build custom HTML with formula
- 7 months ago
You cannot append content to a column dynamically. This must be done with a measure. Best approach is to build the HTML in a DAX measure and render it using an HTML visual.
Example measure:
Image_HTML =
VAR Img1 = IF (SELECTEDVALUE ( Items[Group1] ) = TRUE (),
"<img src='https://url1.png' style='height:30px;margin-right:5px;'/>","")
VAR Img2 = IF (
SELECTEDVALUE ( Items[Group2] ) = TRUE (),
"<img src='https://url2.png' style='height:30px;margin-right:5px;'/>","")
VAR Img3 = IF (
SELECTEDVALUE ( Items[Group3] ) = TRUE (),
"<img src='https://url3.png' style='height:30px;margin-right:5px;'/>", "")
RETURN Img1 & Img2 & Img3Use this measure in an HTML Content visual on the drillthrough page.
This works because:
Measures are evaluated per selected item
HTML can be concatenated conditionally
Only images for TRUE columns are shown
For a cleaner long-term model, unpivot the TRUE/FALSE columns and store image URLs in a lookup table
MichaelRensing I feel like you could use a measure for this but I am not sure that I completely understand what you are trying to accomplish. Any chance you could share some sample data and maybe some additional information about what you are trying to achieve?