Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
fabiolamelo
Helper II
Helper II

How to separate the salary amount from the range in the same column

Hi everyone,

 

I have a table with a number of salaries and a range of it. I am trying to find a way to separate the salary amount from the range in different tables.

 

This is the table now

City                        IdCountry            Salary and Range             

 Canberra            ACT                        61          

 Canberra            ACT                        56 - 66  

 Sydney                 NSW                      56          

 Sydney                 NSW                      51 - 61  

 Regional              NSW                      48 - 65  

 Regional              NSW                      55          

 Darwin                 NT                          51          

 Darwin                 NT                          46 - 57  

 

I would like the table to return this

City                        IdCountry            Range of Salary    Salaries

Canberra              ACT                        56 - 66                   61

Sydney                 NSW                      51 - 61                   56

Regional               NSW                      48 - 65                   55

Darwin                  NT                          46 - 57                  51

 

Is there a way to solve this problem?

Many thanks in advance for your support

Fabiola Melo

2 ACCEPTED SOLUTIONS
az38
Community Champion
Community Champion

Hi @fabiolamelo 

create a new table

Table 2 = 
ADDCOLUMNS(
    FILTER('Table', SEARCH("-", [Salary and Range],,0) > 0),
    "Salaries",
    CALCULATE(MAX('Table'[Salary and Range]), FILTER('Table', 'Table'[City]=EARLIER([City]) && 'Table'[IdCountry] = EARLIER([IdCountry])))
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

v-alq-msft
Community Support
Community Support

Hi, @fabiolamelo 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

b1.PNG

 

You may create a calculated table as below.

New Table = 
SUMMARIZE(
    'Table',
    'Table'[City],
    'Table'[IdCountry],
    "Range of Salary",
    CONCATENATEX(
        FILTER(
            DISTINCT('Table'[Salary and Range]),
            CONTAINSSTRINGEXACT('Table'[Salary and Range],"-")
        ),
        'Table'[Salary and Range],","
    ),
    "Salaries",
    CONCATENATEX(
        FILTER(
            DISTINCT('Table'[Salary and Range]),
            NOT(CONTAINSSTRINGEXACT('Table'[Salary and Range],"-"))
        ),
        'Table'[Salary and Range],","
    )
)

 

Result:

b2.PNG

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @fabiolamelo 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

b1.PNG

 

You may create a calculated table as below.

New Table = 
SUMMARIZE(
    'Table',
    'Table'[City],
    'Table'[IdCountry],
    "Range of Salary",
    CONCATENATEX(
        FILTER(
            DISTINCT('Table'[Salary and Range]),
            CONTAINSSTRINGEXACT('Table'[Salary and Range],"-")
        ),
        'Table'[Salary and Range],","
    ),
    "Salaries",
    CONCATENATEX(
        FILTER(
            DISTINCT('Table'[Salary and Range]),
            NOT(CONTAINSSTRINGEXACT('Table'[Salary and Range],"-"))
        ),
        'Table'[Salary and Range],","
    )
)

 

Result:

b2.PNG

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

az38
Community Champion
Community Champion

Hi @fabiolamelo 

create a new table

Table 2 = 
ADDCOLUMNS(
    FILTER('Table', SEARCH("-", [Salary and Range],,0) > 0),
    "Salaries",
    CALCULATE(MAX('Table'[Salary and Range]), FILTER('Table', 'Table'[City]=EARLIER([City]) && 'Table'[IdCountry] = EARLIER([IdCountry])))
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.