Forum Discussion

Sakthikumar's avatar
Sakthikumar
Frequent Visitor
1 year ago

How to combine two Matrix table into Single Matrix table

In the attached screenshot, I have two different Matrix table visuals. The first table has been created based on the measures listed below. All these measures have been added to the Values fields, with Date added to the columns.

in % = DIVIDE([Manu with>0.5% change],[Total_Count_MANU],0)
Total_Count_MANU =
    COUNTAX(
            SUMMARIZE(
                Base,
                'Base'[Date],
                Base[Category],
                Base[MANU],
                "Monthly%", [Monthly%]
            ),
           
        [Monthly%]
    )

Manu with>0.5% change =
   COALESCE( COUNTAX(
        FILTER(
            SUMMARIZE(
                Base,
                'Base'[Date],
                Base[Category],
                Base[MANU],
                "Monthly%", [Monthly%]
            ),
            OR(
                [Monthly%] > 0.005,
                [Monthly%] < -0.005
            )
        ),
        [Monthly%]
    ),
    0)

In the second screenshot, the matrix table is created based on the following measures. The Category and Manu are placed in the Rows field, Date is placed in the Columns field, and Monthly%_Manu_T is placed in the Values field.
Monthly%_Manu_T1 =
IF(
    HASONEVALUE('Hybrid Matrix'[Date]),
    SWITCH(
        TRUE(),
        VALUES('Hybrid Matrix'[Date]) = DATE(2900,01,01),
        CALCULATE(
            MAXX(
                ALL('Hybrid Matrix'[Date]),
                [Monthly%]
            ),
            REMOVEFILTERS('Hybrid Matrix'[Date])
        ),
        VALUES('Hybrid Matrix'[Date]) = DATE(1900,01,01),
        CALCULATE(
            MINX(
                ALL('Hybrid Matrix'[Date]),
                [Monthly%]
            ),
            REMOVEFILTERS('Hybrid Matrix'[Date])
        ),
        [Monthly%]
    ),

    BLANK()
)
Monthly% =
IF(
    OR
    ([Percent_of_Parent_Row_Total_SIM]<>BLANK(),
    [Percent_of_Parent_Row_Total_BAU]<>BLANK()
    )
    ,
    [Percent_of_Parent_Row_Total_BAU] - [Percent_of_Parent_Row_Total_SIM]
    ,
    0
)
 
Percent_of_Parent_Row_Total_BAU =
DIVIDE(
    [Sales_BAU],
    CALCULATE(
        [Sales_BAU],
        ALLSELECTED('Base'[MANU])
    ),
    0
)
 
Percent_of_Parent_Row_Total_SIM =
DIVIDE(
    [Sales_SIM],
    CALCULATE(
        [Sales_SIM],
        ALLSELECTED(Base[MANU])
    ),
    0
)
I am looking to combine these two table visuals into a single table visualization.

1 Reply

  • Hi Sakthikumar ,

     

    One simple solution is to add 3 rows in your category dimension named for example "A","B", "C" and then write a measure as follows:

    if (selectedvalue (category)="A", [in %],if (selectedvalue (category)="B" , [total] , if (selectedvalue (category)="C" , [Manu with>0.5% change ] , Monthly%_Manu_T1)))

     

    although it might not be the best solution but it works. to find out the best solution it need to know about your data model and....

     

    If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly.