cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Brad
New Member

Power BI - Assign value to column depending on another columns value.

As the title suggests, i want to assign a value to a column depending on another columns value. For example, if the a field in the 'car' column had a value between 0-9 i want the corressponding field in the 'cargroup' column to be 1. If the value in 'car' was 10-19 i want the value in 'cargroup' to be 2 and so on... What formula would i use to do this?

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft
Microsoft

Re: Power BI - Assign value to column depending on another columns value.

Hi @Brad,

The formula @Sean posted is correct. I have test it, it returns the right result.

1.PNG

If you have have resolved your issue, please mark corresponding reply as answer, which will help other people find the solution easily.

Best Regards,
Angelia

View solution in original post

2 REPLIES 2
Sean Community Champion
Community Champion

Re: Power BI - Assign value to column depending on another columns value.

Column =
SWITCH (
    TRUE (),
    'Table'[Car] >= 0  && 'Table'[Car] <= 9, 1,
    'Table'[Car] >= 10 && 'Table'[Car] <= 19, 2,
    3
)
Microsoft
Microsoft

Re: Power BI - Assign value to column depending on another columns value.

Hi @Brad,

The formula @Sean posted is correct. I have test it, it returns the right result.

1.PNG

If you have have resolved your issue, please mark corresponding reply as answer, which will help other people find the solution easily.

Best Regards,
Angelia

View solution in original post

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors