Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi all,
I'm stuck and hope the community can help me.
Simple problem. A table contains:
Fruit Value
Orange 10
Apple 4
Banana 20
Strawberries 7
I have a % parameter (so 0% to 100%) which is selected by the user.
I need a new column with the logic of:
If Fruit = Orange then (Value * % parameter + 10) or;
If Fruit = Apple then (Value * % parameter + 5) or;
If Fruit = Banana then (Value * % parameter + 2)
otherwise return Value
I relatively new to PowerBI so am struggling with nested IF searching for texts and returning a formula. I've looked at many examples but currently haven't got it.
All help welcome. Thanks a lot in advance.
Solved! Go to Solution.
Hi @Anonymous
try this technique
Measure =
var _parameter = DIVIDE(SELECTEDVALUE('Table'[Parameter]), 100)
var _fruit = SELECTEDVALUE('Table'[Fruit])
var _valueParameter = SELECTEDVALUE('Table'[Value])*_parameter
RETURN
SWITCH(TRUE(),
_fruit = "Orange", (_valueParameter + 10),
_fruit = "Apple", (_valueParameter + 5),
_fruit = "Banana", (_valueParameter + 2)
)
Hi @Anonymous
try this technique
Measure =
var _parameter = DIVIDE(SELECTEDVALUE('Table'[Parameter]), 100)
var _fruit = SELECTEDVALUE('Table'[Fruit])
var _valueParameter = SELECTEDVALUE('Table'[Value])*_parameter
RETURN
SWITCH(TRUE(),
_fruit = "Orange", (_valueParameter + 10),
_fruit = "Apple", (_valueParameter + 5),
_fruit = "Banana", (_valueParameter + 2)
)
Thank you for the superfast reply! Yes, the format with some tweaking worked and I learnt a lot on the way.
Really appreciated!
Actually, sorry still stuck. When I use the following with a a whatif parameter, the correct values are returned.
@Anonymous
sorry, I do not understand the issue
also, please set @ in message and choose my login in drop down list to notify me about reply
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |