Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Select fields based on category in a table with DAX calculation

Hello,

 

Is it possible to use a specific field based on what the dimension is?

Like the example below:

What I have:

 

What I am looking for:

 

I cannot merge the two columns in the Power Query - it has to be done with DAX.

 

Thank you 🙂

 

 

  • Hi Anonymous ,

     

    Try to add a new table with the following code:

    Table 2 =
    UNION (
        SELECTCOLUMNS (
            FILTER ( 'Table', 'Table'[Customer] <> BLANK () ),
            "Customer/Product", 'Table'[Customer],
            "Dimension", 'Table'[Dimension]
        ),
        SELECTCOLUMNS (
            FILTER ( 'Table', 'Table'[Product] <> BLANK () ),
            "Customer/Product", 'Table'[Product],
            "Dimension", 'Table'[Dimension]
        )
    )

     

     

     

1 Reply

  • Hi Anonymous ,

     

    Try to add a new table with the following code:

    Table 2 =
    UNION (
        SELECTCOLUMNS (
            FILTER ( 'Table', 'Table'[Customer] <> BLANK () ),
            "Customer/Product", 'Table'[Customer],
            "Dimension", 'Table'[Dimension]
        ),
        SELECTCOLUMNS (
            FILTER ( 'Table', 'Table'[Product] <> BLANK () ),
            "Customer/Product", 'Table'[Product],
            "Dimension", 'Table'[Dimension]
        )
    )