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.
I have a calculated column in one one of my tables that looks at an individuals age and then assigns them into a specific age grouping. Very simple but I need to know based on the current company and date range selected on my report if any of the age groups will have less than a certain number of individuals, if they do then I need to broaden the age grouping. Not sure how to accomplish this in DAX. Here is the current code, any help is much appreciated. Thanks.
Solved! Go to Solution.
Hi @nhale777 ,
According to your description, I create a sample table:
You want to know if any of the age groups will have less than a certain number of individuals, here's my solution:
Create a group table containing all the groups.
Then create a column to calculate the number of individuals belonging to each group:
Column =
COUNTROWS (
FILTER (
'Table',
'Table'[Age]
>= LEFT (
[Group],
SEARCH ( "&", [Group],, SEARCH ( "-", [Group],, SEARCH ( "<", [Group],, 0 ) ) ) - 1
)
&& 'Table'[Age]
< RIGHT (
[Group],
LEN ( [Group] )
- SEARCH ( "&", [Group],, SEARCH ( "-", [Group],, SEARCH ( "<", [Group],, 0 ) ) )
)
)
)
Get the correct result:
I attach my sample below for your reference.
Best regards,
Community Support Team_yanjiang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @nhale777 ,
According to your description, I create a sample table:
You want to know if any of the age groups will have less than a certain number of individuals, here's my solution:
Create a group table containing all the groups.
Then create a column to calculate the number of individuals belonging to each group:
Column =
COUNTROWS (
FILTER (
'Table',
'Table'[Age]
>= LEFT (
[Group],
SEARCH ( "&", [Group],, SEARCH ( "-", [Group],, SEARCH ( "<", [Group],, 0 ) ) ) - 1
)
&& 'Table'[Age]
< RIGHT (
[Group],
LEN ( [Group] )
- SEARCH ( "&", [Group],, SEARCH ( "-", [Group],, SEARCH ( "<", [Group],, 0 ) ) )
)
)
)
Get the correct result:
I attach my sample below for your reference.
Best regards,
Community Support Team_yanjiang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 | |
99 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |