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 Team,
I have a calculated column which returns average sale price (ASP). After calculation I change format to decimal. From that I would like to use Switch formula to determine what price band data falls into.
I am using the following formula... but am getting the following error: "Expression.Error: The import SWITCH matches no exports. Did you miss a module reference?"
Thoughts? Thanks! mibu
SWITCH (
TRUE (),
ASP >= 0
& ASP < 50, "0-50",
ASP >= 50
& ASP < 100, "50-100",
ASP >= 100
& ASP < 150, "100-150",
ASP >= 150
& ASP < 200, "150-200",
ASP >= 200
& ASP < 250, "200-250",
ASP >= 250
& ASP < 300, "250-300",
ASP >= 300
& ASP < 350, "300-350",
ASP >= 350
& ASP < 400, "350-400",
ASP >= 400
& ASP < 450, "400-450",
ASP >= 450
& ASP < 500, "450-500",
ASP >= 500
& ASP < 600, "500-600",
ASP >= 600
& ASP < 700, "600-700",
ASP >= 700
& ASP < 800, "700-800",
ASP >= 800
& ASP < 900, "800-900",
ASP >= 900
& ASP < 1000, "900-1000",
ASP >= 1000
& ASP < 1100, "1000-1100",
ASP >= 1100
& ASP < 1200, "1100-1200",
ASP >= 1200
& ASP < 1300, "1200-1300",
ASP >= 1300
& ASP < 1400, "1300-1400",
ASP >= 1400
& ASP < 1500, "1400-1500",
ASP >= 1500
& ASP < 100000000, "1500+")
Hi @mibu ,
Please try this column.
Column =
VAR _ASP = 'Table'[ASP]
RETURN
SWITCH (
TRUE (),
_ASP >= 0 && _ASP < 50, "0-50",
_ASP >= 50 && _ASP < 100, "50-100",
_ASP >= 100 && _ASP < 150, "100-150",
_ASP >= 150 && _ASP < 200, "150-200",
_ASP >= 200 && _ASP < 250, "200-250",
_ASP >= 250 && _ASP < 300, "250-300",
_ASP >= 300 && _ASP < 350, "300-350",
_ASP >= 350 && _ASP < 400, "350-400",
_ASP >= 400 && _ASP < 450, "400-450",
_ASP >= 450 && _ASP < 500, "450-500",
_ASP >= 500 && _ASP < 600, "500-600",
_ASP >= 600 && _ASP < 700, "600-700",
_ASP >= 700 && _ASP < 800, "700-800",
_ASP >= 800 && _ASP < 900, "800-900",
_ASP >= 900 && _ASP < 1000, "900-1000",
_ASP >= 1000 && _ASP < 1100, "1000-1100",
_ASP >= 1100 && _ASP < 1200, "1100-1200",
_ASP >= 1200 && _ASP < 1300, "1200-1300",
_ASP >= 1300 && _ASP < 1400, "1300-1400",
_ASP >= 1400 && _ASP < 1500, "1400-1500",
_ASP >= 1500 && _ASP < 100000000, "1500+"
)
If this doesn't work for you or I misunderstand your needs, please consider sharing more details about it.
Best Regards,
Community Support Team_Gao
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
@mibu , If ASP is column on measure then [ASP] if it var then ASP , And is && and Or is ||
example
SWITCH (
TRUE (),
[ASP] >= 0 & [ASP] < 50, "0-50",
//Add others
)
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 |
---|---|
114 | |
97 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |