Forum Discussion
Table with multiple measures
- 6 years ago
In general, to use a measure in that way, you need to use the Disconnected Table Trick as this article demonstrates: https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick/ba-p/279563
- 6 years ago
Hi Anonymous ,
We can use the following steps to meet your requirement.
1. Create a crossjoin table that contains the measure of row name and the measure of column name.
crossjoin table = CROSSJOIN(DATATABLE("Row",STRING,{{"Measure 1"},{"Measure 2"}}),DATATABLE("Column",STRING,{{"A"},{"B"}}))2. We can create a measure in crossjoin table,
Measure = SUMX ( VALUES ( 'crossjoin table'[Row] ), SWITCH ( 'crossjoin table'[Row], "Measure 1", SUMX ( VALUES ( 'crossjoin table'[Column] ), SWITCH ( 'crossjoin table'[Column], "A", [Measure 1 - A], "B", [Measure 1 - B] ) ), "Measure 2", SUMX ( VALUES ( 'crossjoin table'[Column] ), SWITCH ( 'crossjoin table'[Column], "A", [Measure 2 - A], "B", [Measure 2 - B] ) ) ) )3. At last we can get the result like this, select a matrix table, and put the crossjoin table[Row] in Rows, put the crossjoin table[Column] in Columns, put the [Measure] in Values.
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
We can use the following steps to meet your requirement.
1. Create a crossjoin table that contains the measure of row name and the measure of column name.
crossjoin table = CROSSJOIN(DATATABLE("Row",STRING,{{"Measure 1"},{"Measure 2"}}),DATATABLE("Column",STRING,{{"A"},{"B"}}))
2. We can create a measure in crossjoin table,
Measure =
SUMX (
VALUES ( 'crossjoin table'[Row] ),
SWITCH (
'crossjoin table'[Row],
"Measure 1", SUMX (
VALUES ( 'crossjoin table'[Column] ),
SWITCH ( 'crossjoin table'[Column], "A", [Measure 1 - A], "B", [Measure 1 - B] )
),
"Measure 2", SUMX (
VALUES ( 'crossjoin table'[Column] ),
SWITCH ( 'crossjoin table'[Column], "A", [Measure 2 - A], "B", [Measure 2 - B] )
)
)
)
3. At last we can get the result like this, select a matrix table, and put the crossjoin table[Row] in Rows, put the crossjoin table[Column] in Columns, put the [Measure] in Values.
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.