Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Guys, I created a Slicer to input value between 0 and 10. [SelMM Value]. And want to use the selected value in a measurement and/or column in IF function.
But the problem is that in the table the SelMM Value is always the default one , it does not change to the selected value. On the report view - the SelMM Value is changing following the selection - but not in the measurement
Solved! Go to Solution.
Hi, @kmilarov
The issue you're encountering is related to the context in which your slicer is being used. Power BI doesn't maintain slicer selection context in the same way that it maintains row or filter context, which is why you are seeing different behavior in different parts of your report. In your measure, the slicer context isn't accessible directly. Instead, you should use your slicer selection in a way that it modifies the filter context of your calculation.
First, modify your SelMM Value as follows:
SelMM Value = MIN('SelMM'[SelMM])
Then, in your measure, you should use your SelMM Value directly because it's now a measure and not a column:
Measure4 =
VAR x = 0
VAR SelMMValue = [SelMM Value] // Directly use the measure here
VAR _1 =
IF ( SUM (Sheet1[B1]) <= SelMMValue, x + 1 )
VAR _2 =
IF ( SUM (Sheet1[B2]) <= SelMMValue, _1 + 1, _1 )
VAR _3 =
IF ( SUM (Sheet1[B3]) <= SelMMValue, _2 + 1, _2 )
RETURN
IF ( SUM (Sheet1[B4]) <= SelMMValue, _3 + 1, _3 )
Also, make sure edit interaction is on for slicer selection.
Proud to be a Super User!
Hi, @kmilarov
The issue you're encountering is related to the context in which your slicer is being used. Power BI doesn't maintain slicer selection context in the same way that it maintains row or filter context, which is why you are seeing different behavior in different parts of your report. In your measure, the slicer context isn't accessible directly. Instead, you should use your slicer selection in a way that it modifies the filter context of your calculation.
First, modify your SelMM Value as follows:
SelMM Value = MIN('SelMM'[SelMM])
Then, in your measure, you should use your SelMM Value directly because it's now a measure and not a column:
Measure4 =
VAR x = 0
VAR SelMMValue = [SelMM Value] // Directly use the measure here
VAR _1 =
IF ( SUM (Sheet1[B1]) <= SelMMValue, x + 1 )
VAR _2 =
IF ( SUM (Sheet1[B2]) <= SelMMValue, _1 + 1, _1 )
VAR _3 =
IF ( SUM (Sheet1[B3]) <= SelMMValue, _2 + 1, _2 )
RETURN
IF ( SUM (Sheet1[B4]) <= SelMMValue, _3 + 1, _3 )
Also, make sure edit interaction is on for slicer selection.
Proud to be a Super User!
Hi again, the slicer and the measurement work perfectly fine , but I face another small problem 🙂 How can I calculate and the total value from the measurements in order to put it on a chart ?
Now can add / vosualise only the single measurements returned from the above code. And only chart that automatically calculates this total is Waterflow chart, but it does not suite / look good for this data. See below a screenshot :
The measure returns in this example 2-1-1-1-1 variables but I need to simonise them (6).
Thank you! It works now 🙂
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
103 | |
101 | |
87 | |
73 | |
67 |
User | Count |
---|---|
119 | |
111 | |
95 | |
79 | |
72 |