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.
Hi I want to use a switch statement whereby I use two fields for the condition e.g.
I want the condition to be:
case 1:
product availability: Y
product stock: 1-10 -> low stock
case 2:
product availability: Y
product stock: 11-50 -> Mid Level Stock
case 3:
product availability: Y
product stock: 11-50 -> High Level Stock
Solved! Go to Solution.
Hi @akhaliq7 .
You can create a measure like;
Availability=
var a=SELECTEDVALUE(Table[Product Stock])
var b=SELECTEDVALUE(Table[Product Availibility)
return
SWITCH(
TRUE(),a="1-10" && b="Y","Low stock",
a="11-50" && b="Y" ,"Mid Level stock",
a="50-100" && b="Y" ,"High Level stock").
Let me know if that works.
Thanks,
Sanket
If this post helps, then mark it as 'Accept as Solution' and give it a thumbs up.
Hi @akhaliq7 try it
VAR stok = sum(table[product stok])
return
SWITCH(
TRUE(),
AND(stok >= 1,stok <= 10), "low stok",
AND(stok >= 11,stok < 50), "mid stok"
stok >=50, "high stok")
Hi @akhaliq7 .
You can create a measure like;
Availability=
var a=SELECTEDVALUE(Table[Product Stock])
var b=SELECTEDVALUE(Table[Product Availibility)
return
SWITCH(
TRUE(),a="1-10" && b="Y","Low stock",
a="11-50" && b="Y" ,"Mid Level stock",
a="50-100" && b="Y" ,"High Level stock").
Let me know if that works.
Thanks,
Sanket
If this post helps, then mark it as 'Accept as Solution' and give it a thumbs up.
thanks your solution worked only thing I changed was instead of a="1-10" i did a>=1 && a<= 10 && b="N".
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 |
---|---|
51 | |
27 | |
24 | |
13 | |
9 |
User | Count |
---|---|
74 | |
56 | |
47 | |
16 | |
12 |