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,
I'm trying to add a calculated column based on conditions in other two columns in the same table to to have three age groups
Age groups = Calculate(IF(filter('Table', 'Table'[Year group] = "N" || able', 'Table'[Year group]able', 'Table'[Year group]="E" && FILTER(Table', 'Table'[Age] < 5)), "Nursery", IF(filter(able', 'Table'[Year group] = "12" || 'Table'[Year group]= "13" && FILTER(Table', 'Table'[Age] > 15)), "Other year groups", "5-15 years")))
The code above gives me this error:
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
Could you please hel me fixx the code?
Solved! Go to Solution.
Hi, @Walaa_86
You can try using only the IF function.
Age groups =
IF (
[Year group] = "N",
"Nursery",
IF (
[Year group] = "E"
&& [Age] < 5,
"Nursery",
IF (
[Year group] = "12"
|| [Year group] = "13"
&& [Age] > 5,
"Other year groups",
"5-15 years"
)
)
)
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Walaa_86
You can try using only the IF function.
Age groups =
IF (
[Year group] = "N",
"Nursery",
IF (
[Year group] = "E"
&& [Age] < 5,
"Nursery",
IF (
[Year group] = "12"
|| [Year group] = "13"
&& [Age] > 5,
"Other year groups",
"5-15 years"
)
)
)
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is how I want my Age group column to look like:
This is how my table looks like. I need to separate the age grous so that I can have Age group as a filter and while I'm filtering for the "nursery" it only shows me year N or E in the year group filter.
can you share an example of your underlying table data?
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 |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |