Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I'm trying to create a column that assigns a value based on following table. Getting DAX error. If I reference AI table and location is x then value is value. Any help would be greatly appreciated.
AI Table Quest New Ideal Column
AI Record Location Weight Value
Weight = SWITCH ( TRUE(),
'AI'[quest] = "California", 6,
'AI'[quest] = "Nebraska", 3,
'AI'[quest] = "Florida", 10,
'AI'[quest] = "Texas", 8,
'AI'[quest] = "Georgia",3,
'AI'[quest] = "Newyork", 10,
'AI'[quest] = "Maryland", 4,
'AI'[quest] = "Ohio", 8,
'AI'[quest] = "Alabama", 10,
)
Solved! Go to Solution.
Hi @Anonymous
you've got an exessive last common ","
anyway, you can try to do it more easy
Weight = SWITCH ( 'AI'[quest],
"California", 6,
"Nebraska", 3,
"Florida", 10,
"Texas", 8,
"Georgia",3,
"Newyork", 10,
"Maryland", 4,
"Ohio", 8,
"Alabama", 10,
"Undefined"
)
Hi @Anonymous ,
In your DAX expression, you have got an extra "," in the end. Just remove it and use the following:
Weight = SWITCH ( TRUE(),
'AI'[quest] = "California", 6,
'AI'[quest] = "Nebraska", 3,
'AI'[quest] = "Florida", 10,
'AI'[quest] = "Texas", 8,
'AI'[quest] = "Georgia",3,
'AI'[quest] = "Newyork", 10,
'AI'[quest] = "Maryland", 4,
'AI'[quest] = "Ohio", 8,
'AI'[quest] = "Alabama", 10
)
This will work.
Thanks.
Hi @Anonymous ,
In your DAX expression, you have got an extra "," in the end. Just remove it and use the following:
Weight = SWITCH ( TRUE(),
'AI'[quest] = "California", 6,
'AI'[quest] = "Nebraska", 3,
'AI'[quest] = "Florida", 10,
'AI'[quest] = "Texas", 8,
'AI'[quest] = "Georgia",3,
'AI'[quest] = "Newyork", 10,
'AI'[quest] = "Maryland", 4,
'AI'[quest] = "Ohio", 8,
'AI'[quest] = "Alabama", 10
)
This will work.
Thanks.
Hi @Anonymous
you've got an exessive last common ","
anyway, you can try to do it more easy
Weight = SWITCH ( 'AI'[quest],
"California", 6,
"Nebraska", 3,
"Florida", 10,
"Texas", 8,
"Georgia",3,
"Newyork", 10,
"Maryland", 4,
"Ohio", 8,
"Alabama", 10,
"Undefined"
)
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
27 | |
12 | |
11 | |
10 | |
6 |