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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
gionniz
New Member

img viewer visual not working with calcultated measure in direct query

Hello,
i need to show an url coming from a calculated measure in the custom component img viewer visual.
This is my formula:
Measure = SWITCH(average(table_1[avg_pages])-average(table_2[avg_pages]); 0; arrowup.png; 10; arrowdown.png)

I am working in direct query mode, so it is not possible to use dax expressions in caluclated column,
and I don't get why it is working in a measure.
My problem is that this custom component only works with columns since url are srtings!
Is there any way to solve it?

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @gionniz,

 

>>My problem is that this custom component only works with columns since url are srtings!

Based on test, the measure will return string values and we are not able to format measure values data type as “Image URL”. While the image viewer visual only supports image URL values, it’s not supported to generate image based on measure values.

 

To work around the issue, you can use query editor to create a custom column like below:

 

Add a custom column to get the result string:

 

let
    Source = Sql.Databases("xxxxx"),
    Datatable = Source{[Name="xxxxx"]}[Data],
    dbo_Table_1 = Datatable {[Schema="dbo",Item="Table_1"]}[Data],
    #"Added Custom" = Table.AddColumn(dbo_Table_1, "Custom", each if List.Average(Table.Column(Table_2, "decimal value"))- List.Average(Table.Column(dbo_Table_1, “amount”)) >50 then "http://www.clipartbest.com/cliparts/jix/pjG/jixpjGdiE.png" else "http://www.freeiconspng.com/uploads/checked-correct-right-yes-checkmark-12.png")
in
    #"Added Custom"

 

 Capture.PNG

 

 

Drag the custom column to imageview:
 Capture2.PNG


Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @gionniz,

 

>>My problem is that this custom component only works with columns since url are srtings!

Based on test, the measure will return string values and we are not able to format measure values data type as “Image URL”. While the image viewer visual only supports image URL values, it’s not supported to generate image based on measure values.

 

To work around the issue, you can use query editor to create a custom column like below:

 

Add a custom column to get the result string:

 

let
    Source = Sql.Databases("xxxxx"),
    Datatable = Source{[Name="xxxxx"]}[Data],
    dbo_Table_1 = Datatable {[Schema="dbo",Item="Table_1"]}[Data],
    #"Added Custom" = Table.AddColumn(dbo_Table_1, "Custom", each if List.Average(Table.Column(Table_2, "decimal value"))- List.Average(Table.Column(dbo_Table_1, “amount”)) >50 then "http://www.clipartbest.com/cliparts/jix/pjG/jixpjGdiE.png" else "http://www.freeiconspng.com/uploads/checked-correct-right-yes-checkmark-12.png")
in
    #"Added Custom"

 

 Capture.PNG

 

 

Drag the custom column to imageview:
 Capture2.PNG


Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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