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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Sax
Helper I
Helper I

Measure behaving differently depending on visual

Hi community,

 

I'm doing some testing on a simple model: 1 fact table (Sales) connected to a dimension table (Products) and a calendar

Sax_0-1685624836669.png

I have 2 visuals: 1 card and 1 column chart

2 filters: Year and quarters

1  tree map for selecting 'Product category' which I'm using as a filter to highlight a sub-category 'Product type' on column chart 

1 measure "Visuals titles" for  both visuals' to create dynamic titles:

Visuals titles =
VAR AllProducts =
IF (
ISBLANK ( SELECTEDVALUE ( 'Calendar'[Quarter/Year] ) ),
"All products, " & SELECTEDVALUE ( 'Calendar'[Year] ),
"All products, " & SELECTEDVALUE ( 'Calendar'[Quarter/Year] )
)
VAR SingleProduct =
IF (
ISBLANK ( SELECTEDVALUE ( 'Calendar'[Quarter/Year] ) ),
SELECTEDVALUE ( Products[Product category] ) & ", "
& SELECTEDVALUE ( 'Calendar'[Year] ),
SELECTEDVALUE ( Products[Product category] ) & ", "
& SELECTEDVALUE ( 'Calendar'[Quarter/Year] )
)
RETURN
IF (
ISBLANK ( SELECTEDVALUE ( Products[Product category] ) ),
AllProducts,
SingleProduct
)

 

If no product is selected, then both visuals' titles behave correctly 

 

Sax_1-1685625941835.png

 

But if I select a product category (for example Firmware),then only the card is displaying the correct title but not the column chart:

Sax_2-1685626112515.png

 

The column chart still displaying 'All products' instead of 'Firmware' and don't understand why that is. 
Besides if instead of a treemap I use a filter instead for 'Product category' then it works but I'd like to keep a treemap as I'd like the chart to be highlighted and not filtered.

 

Can you help?

 

Thank you!

 

Sax

 

 

4 REPLIES 4
johnt75
Super User
Super User

The treemap isn't filtering the column chart, its cross highlighting it, which means that no filters are passed into your measure. I don't think that there is a way to detect whether or not cross highlighting is in effect.

You could use Edit Interactions to make the treemap filter the column chart instead of cross highlighting, that should work.

Hi, thanks. I know that filtering would work but it's something that I wanted to avoid. 
But conceptually, I still don't understand, why is the treemap working for the card and not for column chart?

Thanks

 

 

In the card the value from the treemap is being as a filter, so SELECTEDVALUE will return a single value. Because the column chart is not being filtered then SELECTEDVALUE will return blank, as multiple values are visible, so your measure will return the value for all products.

Thanks...what you just said is still sinking in due to my limited knowledge of functions. 
I guess another more creative way is to deselect the column chart's title and overlay the card's title instead...

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors