cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dpombal Member
Member

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

Accepted Solutions
Community Support Team
Community Support Team

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

@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.
7 REPLIES 7
Community Support Team
Community Support Team

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

@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.
dpombal Member
Member

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

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

Community Support Team
Community Support Team

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

@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.
dpombal Member
Member

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

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

Community Support Team
Community Support Team

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

@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.
dpombal Member
Member

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

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

Community Support Team
Community Support Team

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

@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.