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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MelForsyth
New Member

Use harvested slicer in calculation

I am using a box and whiskers graph to show some data but this data has a range of outliers so I want to be able to filter the graph by standard deviation as selected by the user.

I have created a table and off that table a slicer so the user can select between 1 and 20 standard deviations

Table: StandardDeviation

MelForsyth_1-1636665838462.png

Slicer: 

MelForsyth_2-1636665885124.png

In my KeyMeasures Table I have created a measure:

STDValue = SELECTEDVALUE( StandardDeviation[STD] , 0 )

 

Standard Deviation - Calculated Column

STD-AtoB = STDEV.P(Visits[AtoB (Minutes)])

 

When I use the above STD-AtoB and multiply it by 4 std it works but if I try to pass the slicer value [STDValue] it returns 0

ScaledX4-AtoB =
VAR Mean = AVERAGE(Visits[AtoB (Minutes)])
RETURN
IF(
Visits[AtoB (Minutes)] > Mean + Vists[STD-AtoB] * 4,
Mean + Vists[STD-AtoB] * 4,
Visits[AtoB (Minutes)]
)

with slicer value:

ScaledX4-AtoB =
VAR Mean = AVERAGE(Visits[AtoB (Minutes)])
RETURN
IF(
Visits[AtoB (Minutes)] > Mean + Vists[STD-AtoB] * [STDValue],
Mean + Vists[STD-AtoB] * [STDValue],
Visits[AtoB (Minutes)]
)

I broke down the calculation to see if it would return the value and it returns 4 as selected in the slicer, so why won't it multiply in my above calculation?

ScaledX4-AtoB

Scaled-TriagetoDMC =
RETURN
[STDValue]

 

I have tried moving the slicer value to the visits table and the key measures table, and taking it directly from the StandardDeviation table and even changing it to a calculated column in the Visits table

Using max/sum only gave me the max/sum of the (StandardDeviation[STD]) column.
There is too much sensitive data to post my analytic

1 ACCEPTED SOLUTION

It should be possible as a measure but will need to be adjusted. I don't quite follow how it's supposed to work, so it's hard to suggest something specific but this might get you closer:

ScaledX4-AtoB =
VAR Mean = CALCULATE ( AVERAGE ( Visits[AtoB (Minutes)] ), ALLSELECTED () )
VAR CurrAB = AVERAGE ( Visits[AtoB (Minutes)] )
VAR SD = CALCULATE ( [STD-AtoB], ALLSELECTED () )
VAR SlicerSTD = [STDValue]
RETURN
    IF ( CurrAB > Mean + SD * SlicerSTD, Mean + SD * SlicerSTD, CurrAB )

View solution in original post

4 REPLIES 4
MelForsyth
New Member

Yes I am, which makes sense now.  

Can I still do what I am trying to do in this as a measure?

 

ScaledX4-AtoB =
VAR Mean = AVERAGE(Visits[AtoB (Minutes)])
RETURN
IF(
Visits[AtoB (Minutes)] > Mean + Vists[STD-AtoB] * [STDValue],
Mean + Vists[STD-AtoB] * [STDValue],
Visits[AtoB (Minutes)]
)

It should be possible as a measure but will need to be adjusted. I don't quite follow how it's supposed to work, so it's hard to suggest something specific but this might get you closer:

ScaledX4-AtoB =
VAR Mean = CALCULATE ( AVERAGE ( Visits[AtoB (Minutes)] ), ALLSELECTED () )
VAR CurrAB = AVERAGE ( Visits[AtoB (Minutes)] )
VAR SD = CALCULATE ( [STD-AtoB], ALLSELECTED () )
VAR SlicerSTD = [STDValue]
RETURN
    IF ( CurrAB > Mean + SD * SlicerSTD, Mean + SD * SlicerSTD, CurrAB )

Perfect, thank you 😊

AlexisOlson
Super User
Super User

Are you trying to use [STDValue] in a calculated column? (Calculated columns cannot read slicers.)

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors