Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Add extra columns in matrix visual

Sorry if there is any similar issue. I am stuck with an issue and need this issue solve soon. Please let me know any suggestions or tips and tricks or anyway i can clear this.

I have table1 and table2 where table1 is transaction table and table2 is lookup table. (Note the values in db are dummy data)
table 1

 

table 2

We have calculated columns for NetSales and GrossMargin by below 
NetSales = Sample * Rate1 where Table1(Brand) = Table2(Brand) and Category = NetSales
Gross Margin = Sample * Rate1 where Table1(Brand) = Table2(Brand) and Category = Gross Margin


We have created tables for Sample, Trx, NetSales and Gross Margin like below
sampleTable = SUMMARIZE( Table1, Table1[Date], Table1[Territory], Table1[Region], Table1[Brand], "Value" , SUM(Table1[Sample])
added a column Type = "Sample" to the sampleTable.
similarly we have created table for Trx, NetSales and GrossMargin and added Type as Trx, NetSales and GrossMargin respectively.

 

Now we have created a new table 
FinalTable = UNION(SampleTable, TrxTable, NetSalesTable, GrossMarginTable)
Using this FinalTable, I have created calculated columns from January to 2019YTD.
I have created a matrix visual as below 

 

 

Now I need to create a matrix where in place of Types I need to display the stats the same way as above
So I have created the measures for stat1 and stat2.
Stat1 = Trx/Sample
Stat2 = NetSales/Trx

 


Now I want to add the columns 2018YTD, 2019YTD, Increase(Decrease) and Percent columns in the above  Statistics visual. 
Can anyone help me with that. Thanks in advance. 

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello All,

    Just need to know if this is possible. Please do let me know .

    Measure Stat1 = SUM(Table1[Trx]) / SUM(Table1[Samples])
    Measure Stat2 = SUM(Table1[NetSales]) / SUM(Table1[Samples])

    I have YTD and LYTD measures also.

    Can I get the result in the matrix as shown below. Please let me know with the solution. 

    StatisticNovemberDecemberCurrent YTDPrevious YTDChange in YTDPercent
    Stat1  ??  
    Stat2  ??  


    Note Stat1, Stat2, CurrentYTD, PreviousYTD ,Change in YTD and Percent are all measures. If it is not possible to do with measures then suggest me with some other way. I have been trying this from many days. Thanks in advance.