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
Syndicate_Admin
Administrator
Administrator

Create a column in the assignment table with families of other columns and tables

Hello everyone,

What I want is to create a column in the Orders table that is my fact, with some names of some columns in the same table and with some names of other columns in other tables.

EncargosAnx[propiedad_2] = DI , ME

EncargosAnx[propiedad_3] = LCP, LCC

Family[families] = SUN, COLD


This is the union of tables among which I mention, through a column called familias_id

migueldfr_0-1736372942904.png

What I want is to create a column in Orders, containing all the names I mentioned above, and only those names, to call the column Families, and be able to filter in my report by families, but all unified in one column

Thank you very much and I appreciate any help.

1 ACCEPTED SOLUTION
v-linyulu-msft
Community Support
Community Support

Hi, @Syndicate_Admin 
Thanks for reaching out to the Microsoft fabric community forum.

Regarding the issue you raised, my solution is as follows:

1.Based on your description, I have created the following test data:

vlinyulumsft_0-1736400298148.png
vlinyulumsft_1-1736400298148.png

vlinyulumsft_2-1736400315316.png

 

2.I have provided two solutions for you:

 

Measure:

vlinyulumsft_3-1736400315316.png

FamiliesMeasure = 
VAR prop2 = 
    IF (
        MAX('EncargosAnx(Orders)'[propiedad_2]) IN {"DI", "ME"},
        MAX('EncargosAnx(Orders)'[propiedad_2]),
        BLANK()
    )
VAR prop3 = 
    IF (
        MAX('EncargosAnx(Orders)'[propiedad_3]) IN {"LCP", "LCC"},
        MAX('EncargosAnx(Orders)'[propiedad_3]),
        BLANK()
    )
VAR family = 
    CALCULATE (
        VALUES('Familias(Family)'[families]),
        FILTER (
            'Familias(Family)',
            'Familias(Family)'[familias_id] = SELECTEDVALUE('EncargosAnx(Orders)'[familias_id]) &&
            'Familias(Family)'[families] IN {"SUN", "COLD"}
        )
    )
RETURN
    IF(ISINSCOPE('EncargosAnx(Orders)'[Year ]),CONCATENATE (
        CONCATENATE (prop2 & ",", prop3 & ","),
        family
    ),BLANK())

 

Calculated Column:

 

vlinyulumsft_4-1736400334489.png

FamiliesColumn = 
VAR prop2 = 
    IF (
        'EncargosAnx(Orders)'[propiedad_2] IN {"DI", "ME"},
        'EncargosAnx(Orders)'[propiedad_2],
        BLANK()
    )
VAR prop3 = 
    IF (
        'EncargosAnx(Orders)'[propiedad_3] IN {"LCP", "LCC"},
        'EncargosAnx(Orders)'[propiedad_3],
        BLANK()
    )
VAR family = 
    CALCULATE (
        VALUES('Familias(Family)'[families]),
        FILTER (
            'Familias(Family)',
            'Familias(Family)'[familias_id] = 'EncargosAnx(Orders)'[familias_id] &&
            'Familias(Family)'[families] IN {"SUN", "COLD"}
        )
    )
RETURN
    CONCATENATE (
        CONCATENATE (prop2 & ",", prop3 & ","),
        family
    )

3.Here's my final result, which I hope meets your requirements.

 

vlinyulumsft_5-1736400358536.png

Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.When uploading a file, please be careful to delete sensitive information.

For questions about uploading data, you can try the following links:

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Solved: How to upload PBI in Community - Microsoft Fabric Community

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

1 REPLY 1
v-linyulu-msft
Community Support
Community Support

Hi, @Syndicate_Admin 
Thanks for reaching out to the Microsoft fabric community forum.

Regarding the issue you raised, my solution is as follows:

1.Based on your description, I have created the following test data:

vlinyulumsft_0-1736400298148.png
vlinyulumsft_1-1736400298148.png

vlinyulumsft_2-1736400315316.png

 

2.I have provided two solutions for you:

 

Measure:

vlinyulumsft_3-1736400315316.png

FamiliesMeasure = 
VAR prop2 = 
    IF (
        MAX('EncargosAnx(Orders)'[propiedad_2]) IN {"DI", "ME"},
        MAX('EncargosAnx(Orders)'[propiedad_2]),
        BLANK()
    )
VAR prop3 = 
    IF (
        MAX('EncargosAnx(Orders)'[propiedad_3]) IN {"LCP", "LCC"},
        MAX('EncargosAnx(Orders)'[propiedad_3]),
        BLANK()
    )
VAR family = 
    CALCULATE (
        VALUES('Familias(Family)'[families]),
        FILTER (
            'Familias(Family)',
            'Familias(Family)'[familias_id] = SELECTEDVALUE('EncargosAnx(Orders)'[familias_id]) &&
            'Familias(Family)'[families] IN {"SUN", "COLD"}
        )
    )
RETURN
    IF(ISINSCOPE('EncargosAnx(Orders)'[Year ]),CONCATENATE (
        CONCATENATE (prop2 & ",", prop3 & ","),
        family
    ),BLANK())

 

Calculated Column:

 

vlinyulumsft_4-1736400334489.png

FamiliesColumn = 
VAR prop2 = 
    IF (
        'EncargosAnx(Orders)'[propiedad_2] IN {"DI", "ME"},
        'EncargosAnx(Orders)'[propiedad_2],
        BLANK()
    )
VAR prop3 = 
    IF (
        'EncargosAnx(Orders)'[propiedad_3] IN {"LCP", "LCC"},
        'EncargosAnx(Orders)'[propiedad_3],
        BLANK()
    )
VAR family = 
    CALCULATE (
        VALUES('Familias(Family)'[families]),
        FILTER (
            'Familias(Family)',
            'Familias(Family)'[familias_id] = 'EncargosAnx(Orders)'[familias_id] &&
            'Familias(Family)'[families] IN {"SUN", "COLD"}
        )
    )
RETURN
    CONCATENATE (
        CONCATENATE (prop2 & ",", prop3 & ","),
        family
    )

3.Here's my final result, which I hope meets your requirements.

 

vlinyulumsft_5-1736400358536.png

Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.When uploading a file, please be careful to delete sensitive information.

For questions about uploading data, you can try the following links:

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Solved: How to upload PBI in Community - Microsoft Fabric Community

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

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! Prices go up Feb. 11th.

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.