Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello everyone,
I'm new to Power BI and its Data editor.
I'm trying to create a new column of Age Range using the IF function.
Here's my code line:
if #[AGE_MOYEN] >= 65, "65ans et plus",
if #[AGE_MOYEN] >= 60 and #[AGE_MOYEN] = 64, "60/64 ans",
if #[AGE_MOYEN] >= 55 and #[AGE_MOYEN] = 59, "55/59 ans",
if #[AGE_MOYEN] >= 50 and #[AGE_MOYEN] = 54, "50/54 ans",
if #[AGE_MOYEN] >= 45 and #[AGE_MOYEN] = 49, "45/49 ans",
if #[AGE_MOYEN] >= 40 and #[AGE_MOYEN] = 44, "40/44 ans",
if #[AGE_MOYEN] >= 35 and #[AGE_MOYEN] = 39, "35/39 ans",
if #[AGE_MOYEN] >= 30 and #[AGE_MOYEN] = 34, "30/34 ans",
if #[AGE_MOYEN] >= 25 and #[AGE_MOYEN] = 29, "25/29 ans",
if #[AGE_MOYEN] >= 20 and #[AGE_MOYEN] = 24, "20/24 ans",
if #[AGE_MOYEN] < 20 , "-20 ans"
But i have this message error "Literal Token expected", showing me i need a literal token in [AGE_MOYEN]. I cant find a way to solve this.
Can someone give some tips?
Regards,
Solved! Go to Solution.
@tellech , if this is dax column, it need to like
Switch(True() ,
[AGE_MOYEN] >= 65, "65ans et plus",
[AGE_MOYEN] >= 60 && [AGE_MOYEN] = 64, "60/64 ans",
[AGE_MOYEN] >= 55 && [AGE_MOYEN] = 59, "55/59 ans",
[AGE_MOYEN] >= 50 && [AGE_MOYEN] = 54, "50/54 ans",
[AGE_MOYEN] >= 45 && [AGE_MOYEN] = 49, "45/49 ans",
[AGE_MOYEN] >= 40 && [AGE_MOYEN] = 44, "40/44 ans",
[AGE_MOYEN] >= 35 && [AGE_MOYEN] = 39, "35/39 ans",
[AGE_MOYEN] >= 30 && [AGE_MOYEN] = 34, "30/34 ans",
[AGE_MOYEN] >= 25 && [AGE_MOYEN] = 29, "25/29 ans",
[AGE_MOYEN] >= 20 && [AGE_MOYEN] = 24, "20/24 ans",
[AGE_MOYEN] < 20 , "-20 ans")
@tellech , if this is dax column, it need to like
Switch(True() ,
[AGE_MOYEN] >= 65, "65ans et plus",
[AGE_MOYEN] >= 60 && [AGE_MOYEN] = 64, "60/64 ans",
[AGE_MOYEN] >= 55 && [AGE_MOYEN] = 59, "55/59 ans",
[AGE_MOYEN] >= 50 && [AGE_MOYEN] = 54, "50/54 ans",
[AGE_MOYEN] >= 45 && [AGE_MOYEN] = 49, "45/49 ans",
[AGE_MOYEN] >= 40 && [AGE_MOYEN] = 44, "40/44 ans",
[AGE_MOYEN] >= 35 && [AGE_MOYEN] = 39, "35/39 ans",
[AGE_MOYEN] >= 30 && [AGE_MOYEN] = 34, "30/34 ans",
[AGE_MOYEN] >= 25 && [AGE_MOYEN] = 29, "25/29 ans",
[AGE_MOYEN] >= 20 && [AGE_MOYEN] = 24, "20/24 ans",
[AGE_MOYEN] < 20 , "-20 ans")
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
19 | |
14 | |
10 | |
7 |