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
dpombal
Post Patron
Post Patron

Dynamic image based on Slicer ( Blank if all items selected)

Hi all,

I need to view image logo only in 1 unique element of a slicer is selected:

 

My problem is that only calculated columns are available to be categorized as  url of image

 

 

I tried creating this measure:

Selected = SELECTEDVALUE(Images[logo])

 

And image should be displayed based on this formula (problem is that a measure is not valid to be categorized as image url)

 

calc_image = IF( ISBLANK([Selected]); BLANK(); [Selected])

 

Sample PBIX:

https://1drv.ms/u/s!Am7buNMZi-gwkAVpbGpxqpsXySqZ

 

Data , table images with 3 rows (product, logo)

 

Blog_1_Data.PNG

 

 

 

 

 

 

 

Report View: Slicer with product

 

Blog_2_Image_Report view.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Regards

1 ACCEPTED SOLUTION

@dpombal,

 

You may refer to the code below.

    tmp = Table.AddColumn(Table.FromList(Table.ColumnNames(dbo_stg_investors)), "Custom", each null),
    result = Table.InsertRows(dbo_stg_investors
                                , 0
                                , Table.ToRecords(Table.Pivot(tmp, List.Distinct(tmp[Column1]), "Column1", "Custom")))
in
    result
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-chuncz-msft
Community Support
Community Support

@dpombal,

 

Values in a calculated column are fixed. As a workaround, you may add a blank row.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msftI am not following how a blank row helps me? did you understand my issue?

@dpombal,

 

Just try it, you'll see the difference.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

It works, however i had to manually add 1 row with an space character to product column and empty image url.

Is there any smart way to ADD a blank row into an existing table for example of SQL Server.

 

Something link given a big table + 1 Blank row in power query / DAX @v-chuncz-msft

@dpombal,

 

You may use Table.InsertRows function.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

How can I add a blank row to this M code

 

let
    Origen = Sql.Database(servidor, base_datos),
    dbo_stg_investors = Origen{[Schema="dbo",Item="stg_investors"]}[Data]
in
    dbo_stg_investors

@dpombal,

 

You may refer to the code below.

    tmp = Table.AddColumn(Table.FromList(Table.ColumnNames(dbo_stg_investors)), "Custom", each null),
    result = Table.InsertRows(dbo_stg_investors
                                , 0
                                , Table.ToRecords(Table.Pivot(tmp, List.Distinct(tmp[Column1]), "Column1", "Custom")))
in
    result
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.