Forum Discussion
Create a table/matrix where rows and colums are the same field and the values are the difference
Hi Tasnalem
I have understood your problem.
You need to create a matrix with rows and columns that are months, and the values in the table are the difference between the values of the month.
Here is the solution:
First, I created a set of reference data.
Then, extract the month.
With the DAX:
------------------------------------------------------------
Month = FORMAT([value_date],"mmmm")
------------------------------------------------------------
Then, a table 2 is created based on the value and month of Table 1
------------------------------------------------------------
Table 2 = SELECTCOLUMNS('Table',[Month],[value])
------------------------------------------------------------
Next, use the crossjoin function to create a new table.
The table contains the Cartesian product of all rows from all tables in the arguments
------------------------------------------------------------
Table 3 = CROSSJOIN('Table','Table 2')
------------------------------------------------------------
Create a measure to calculate the difference for the corresponding month:
------------------------------------------------------------
Measure = SUM('Table 3'[value])-SUM('Table 3'[Table_value])
------------------------------------------------------------
Then create a Matrix, Row is Month, Columns is Table_Month, Values is Measure:
Best Regards,
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello,
Thanks for the answer, that is want i want to achieve, but this solution is not suitable for huge dataset, because I have an error related to memory failure when I do the CROSSJOIN step. Do you know any other solution without this CROSSJOIN?