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 t...
  • MFelix's avatar
    4 years ago

    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]
        )
    )