Forum Discussion
Calculated Column on a Measure not returning correct values
- 3 years ago
PowerAuto82 you cannot convert measure to a conditional column, You need a disconnected table and then use that for visual, check this blog post on dynamic segmentation Dynamic segmentation – DAX Patterns
✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
- 3 years ago
I made a change to the current DAX to the below
Age 2 = AVERAGEX ( VALUES ( 'Calendar'[Date].[Year] ), VAR EmployeeInSegment = FILTER ( ALLSELECTED ( Employee ), VAR AgeOfEmployee = [Age] VAR SegmentForEmployee = FILTER ( 'Age Band Desc', NOT ISBLANK ( AgeOfEmployee ) && 'Age Band Desc'[Start] <= AgeOfEmployee && 'Age Band Desc'[End] >= AgeOfEmployee8 ) VAR IsCustomerInSegments = NOT ISEMPTY ( SegmentForEmployee ) RETURN IsCustomerInSegments ) VAR Result = CALCULATE ( [Age], KEEPFILTERS ( EmployeeInSegment ) ) RETURN Result )
PowerAuto82 keep the measure, you need a new table with the range and then use that as described in the blog post.
✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
I made a change to the current DAX to the below
Age 2 =
AVERAGEX (
VALUES ( 'Calendar'[Date].[Year] ),
VAR EmployeeInSegment =
FILTER (
ALLSELECTED ( Employee ),
VAR AgeOfEmployee = [Age]
VAR SegmentForEmployee =
FILTER (
'Age Band Desc',
NOT ISBLANK ( AgeOfEmployee )
&& 'Age Band Desc'[Start] <= AgeOfEmployee
&& 'Age Band Desc'[End] >= AgeOfEmployee8
)
VAR IsCustomerInSegments = NOT ISEMPTY ( SegmentForEmployee )
RETURN IsCustomerInSegments
)
VAR Result =
CALCULATE (
[Age],
KEEPFILTERS ( EmployeeInSegment )
)
RETURN Result
)