Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
How can i achieve below kind of view in power bi matrix visual?
Thanks in Advance
Solved! Go to Solution.
Hi @SK1180 ,
Please create the new table.
Columns =
UNION (
CROSSJOIN ( { "By Product" }, VALUES ( 'Table'[Product] ) ),
CROSSJOIN ( { "By Year" }, VALUES ( 'Table'[Year] ) ),
CROSSJOIN (
{ "Summarizations" },
SELECTCOLUMNS (
{ "Total", "% of Total Sales", "Avg Sale Size" },
"value2", [Value]
)
)
)
Then create the measure.
MatrixValue =
VAR ByProduct =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER ( 'Table', 'Table'[Product] = MAX ( 'Columns'[Sub_header] ) )
)
VAR ByYear =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER (
'Table',
FORMAT ( 'Table'[Year], 0000 ) = MAX ( 'Columns'[Sub_header] )
)
)
VAR total = SUM ( 'Table'[Sales] )
VAR totalPercent = total / SUMX ( ALL ( 'Table' ), 'Table'[Sales] )
VAR Avg_ = AVERAGE ( 'Table'[Sales] )
RETURN
SWITCH (
MAX ( 'Columns'[Header] ),
"By Product", ByProduct,
"By Year", ByYear,
SWITCH (
MAX ( 'Columns'[Sub_header] ),
"Total", total,
"% of Total Sales", FORMAT ( totalPercent, "Percent" ),
"Avg Sale Size", FORMAT ( Avg_, ".0" )
)
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @SK1180 ,
Please create the new table.
Columns =
UNION (
CROSSJOIN ( { "By Product" }, VALUES ( 'Table'[Product] ) ),
CROSSJOIN ( { "By Year" }, VALUES ( 'Table'[Year] ) ),
CROSSJOIN (
{ "Summarizations" },
SELECTCOLUMNS (
{ "Total", "% of Total Sales", "Avg Sale Size" },
"value2", [Value]
)
)
)
Then create the measure.
MatrixValue =
VAR ByProduct =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER ( 'Table', 'Table'[Product] = MAX ( 'Columns'[Sub_header] ) )
)
VAR ByYear =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER (
'Table',
FORMAT ( 'Table'[Year], 0000 ) = MAX ( 'Columns'[Sub_header] )
)
)
VAR total = SUM ( 'Table'[Sales] )
VAR totalPercent = total / SUMX ( ALL ( 'Table' ), 'Table'[Sales] )
VAR Avg_ = AVERAGE ( 'Table'[Sales] )
RETURN
SWITCH (
MAX ( 'Columns'[Header] ),
"By Product", ByProduct,
"By Year", ByYear,
SWITCH (
MAX ( 'Columns'[Sub_header] ),
"Total", total,
"% of Total Sales", FORMAT ( totalPercent, "Percent" ),
"Avg Sale Size", FORMAT ( Avg_, ".0" )
)
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
96 | |
77 | |
63 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |