Forum Discussion
Power BI Matrix - Multiple Measures are Switch values to Rows and Month in Columns, need month wise
Thanks for the reply from DataNinja777 , please allow me to provide another insight:
Hi, sathish719
Thanks for reaching out to the Microsoft fabric community forum.
Regarding the issue you raised, my solution is as follows:
1.Firstly, based on your description, I have created the following test data:
2. Secondly, I have created the following calculated table:
Table2 =
VAR nt =
SUMMARIZE (
'Table',
[Measures],
[Attribute],
[Value],
"index", SWITCH ( 'Table'[Attribute], "Jan", 1, "Feb", 2, "March", 3 )
)
VAR _summarize1 =
SUMMARIZE (
'Table',
[Measures],
"Attribute", "March vs Feb",
"Value",
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', 'Table'[Attribute] = "March" )
)
- CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', 'Table'[Attribute] = "Feb" )
),
"index", 4
)
VAR _summarize2 =
SUMMARIZE (
'Table',
[Measures],
"Attribute", "March vs Jan",
"Value",
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', 'Table'[Attribute] = "March" )
)
- CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', 'Table'[Attribute] = "Jan" )
),
"index", 5
)
VAR _summarize3 =
SUMMARIZE (
'Table',
[Measures],
"Attribute", "Feb vs Jan",
"Value",
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', 'Table'[Attribute] = "Feb" )
)
- CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', 'Table'[Attribute] = "Jan" )
),
"index", 6
)
RETURN
UNION ( nt, _summarize1, _summarize2, _summarize3 )
3.Then, I adjusted the sorting:
4.Here's my final result, which I hope meets your requirements.
You may need to note that I am not entirely clear on your data structure, so your data structure might differ from mine (in my case, the date column's data structure is a string). If my response does not resolve your issue, I would appreciate it if you could share your data structure with me, especially the composition of the matrix visual object. This will greatly assist us in analysing and providing an appropriate solution to your problem.When uploading a file, please be careful to delete sensitive information.
For questions about uploading data, you can try the following links:
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Solved: How to upload PBI in Community - Microsoft Fabric Community
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.