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
tgjones43
Helper IV
Helper IV

Adding measure to a table - slicers ignored

When I add a measure to a table, the slicers that were applied to that table are ignored. I assume this is because there is always a value in the measure, as related to this forum post https://community.powerbi.com/t5/Desktop/New-Measure-prevents-Slicer-from-working/td-p/470557, but I can't work out the formula I need.

 

The formaula I have is as follows. So it is looking at columns in 2 related tables. I am also not sure if SELECTEDVALUE is the right code to use here.

 

Measure = IF(SELECTEDVALUE('TABLE2'[Width])<5,INT(((SELECTEDVALUE('TABLE1'[Age1]))/0.5395)+0.5),INT(((SELECTEDVALUE('TABLE1'[Age1]))/0.5106)+0.5))

 

Can anyone help please?

1 ACCEPTED SOLUTION

Hi @tgjones43 ,

 

Take try of this one:

Measure = var a = MAX('Observations'[Age1])/0.5395
var b = MAX('Observations'[Age1])/0.5106
Return
IF(MAX('Observation Attributes'[Width])<5&&NOT(ISBLANK(a)),INT(a+0.5),IF(MAX('Observation Attributes'[Width])>=5&&NOT(ISBLANK(b)),INT(b+0.5),BLANK()))

10.PNG

 

Community Support Team _ Dina Ye
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

4 REPLIES 4
v-diye-msft
Community Support
Community Support

Hi @tgjones43 ,

 

Could you please share your dummy pbix? what would be easier for us to provide the valuable advice.

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

Hi @v-diye-msft 

 

Please find the link to a simplified pbix file below. In creating this file I realise the issue is with the +0.5 in the measure. Remove this and the measure works fine in the table. So I just need some different code to deal with this.

 

Basically what the measure is doing is applying a slightly different calculation to the values in [Age1] depending on whether the value in [Width] is greater or less than 5

 

https://www.dropbox.com/s/0pnmaz3c5rmdrtt/SlicerMeasureExample.pbix?dl=0

Hi @tgjones43 ,

 

Take try of this one:

Measure = var a = MAX('Observations'[Age1])/0.5395
var b = MAX('Observations'[Age1])/0.5106
Return
IF(MAX('Observation Attributes'[Width])<5&&NOT(ISBLANK(a)),INT(a+0.5),IF(MAX('Observation Attributes'[Width])>=5&&NOT(ISBLANK(b)),INT(b+0.5),BLANK()))

10.PNG

 

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

Thank you @v-diye-msft How can I get the measure to display 0 rather than be blank when there is no value in [Age1]?

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.