The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I created a what-if parameter called 'Default Target'[Default Target] that ranges from 0.8 to 0.99 in 0.01 increments. The what if parameter also built a measure for me called [Default Target Value] which is meant to return the selectedvalue of the parameter, or its default value:
Default Target Value = SELECTEDVALUE('Default Target'[Default Target], 0.94)
I want to prescribe certain [Default Targets] to load into a table, so I built them to use TREATAS to filter the table:
86_perc = CALCULATE( [MyFancyMeasure], TREATAS({{0.86}},'Default Target'[Default Target]) )
but this didn't give me the expected result (I was expecting it to use 86% as default target, not 94%).
Instead, it returns all rows based on the <alternateResult> of the selectedvalue measure:
|
Why is [CAR_86] not aligning with the actual selectedvalue of the what-if parameter slicer, and also not aligning to the filtered value from the TREATAS function? How can I effectively pass a constant to [MyFancyMeasure] so I don't have to rewrite the entire measure for each constant I want to present?
Edit: I also tried to filter the default target table in the calculate like this but it does the same thing:
CAR_86 = CALCULATE( [Default Target Value], FILTER(ALL('Default Target'),[Default Target]=0.86) )
Solved! Go to Solution.
@amitchandak Thanks for responding.
In this case I actually found the solution. The problem has to do with the level of precision in the numbers returned from the GENERATESERIES function which produces the What-If inputs. 0.86 wasn't actually present in the column:
TREATAS( {0.86} , 'Default Target'[Default Target] )
doesn't work, however:
TREATAS({0.8600000000000002}, 'Default Target'[Default Target] )
Default Target = GENERATESERIES(CURRENCY(0.6), 1.0, CURRENCY(0.001))
@cmeu , The measure where you do need .94 as default use this ?
Take it a var and pass it.
SELECTEDVALUE('Default Target'[Default Target], 0.86)
If you want to remove a selected value, then why do you need whatif, you can filter on static value.
@amitchandak Thanks for responding.
In this case I actually found the solution. The problem has to do with the level of precision in the numbers returned from the GENERATESERIES function which produces the What-If inputs. 0.86 wasn't actually present in the column:
TREATAS( {0.86} , 'Default Target'[Default Target] )
doesn't work, however:
TREATAS({0.8600000000000002}, 'Default Target'[Default Target] )
Default Target = GENERATESERIES(CURRENCY(0.6), 1.0, CURRENCY(0.001))
User | Count |
---|---|
24 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
31 | |
11 | |
10 | |
10 | |
9 |