Reputation: 119
I have a data model here.
I added in a measure -
Test_SelectedValue =
CALCULATE (
COUNTROWS ( Fact_Test ),
FILTER (
Fact_Test,
Fact_Test[Sold]
<= PERCENTILE.INC ( Fact_Test[Sold], SELECTEDVALUE (Threshold[Threshold]) )
)
)
After nothing adds up. (image below) I want the measure to change with the selectedvalue dynamically
Upvotes: 0
Views: 97
Reputation: 40204
This is because the threshold is being calculated separately for each row in your visual. I don't think that's what you're after. Try something like this instead:
Test_SelectedValue =
VAR Thresh =
CALCULATE (
PERCENTILE.INC ( Fact_Test[Sold], SELECTEDVALUE ( Threshold[Threshold] ) ),
ALLSELECTED ()
)
RETURN
CALCULATE (
COUNTROWS ( Fact_Test ),
FILTER ( Fact_Test, Fact_Test[Sold] <= Thresh )
)
This should remove the local filter context of date and region when calculating the threshold so that each row in your table is using the same population to calculate the percentile.
Upvotes: 1