Forum Discussion
Assistance Needed: Complex Matrix Visual Requirements
- Anonymous2 years ago
Hi Learner27 ,
Unfortunately, I cannot open your sample Pbix file. I create a sample data to help you with your problem.
Sample data:1.Create a Date Table, and make a relationship between two tables. Put the DateTable into the Slicer.
2.Add new measures.
In Matrix 1:
Current Year number = CALCULATE ( SUM ( 'Table'[number] ), FILTER ( ALL ( 'Table'[Date] ), YEAR ( 'Table'[Date] ) = YEAR ( MAX ( 'Table'[Date] ) ) && MONTH ( 'Table'[date] ) = MONTH ( MAX ( 'Table'[date] ) ) ) )Previous Year number = CALCULATE ( SUM ( 'Table'[number] ), FILTER ( ALL ( 'Table'[Date] ), YEAR ( 'Table'[Date] ) = YEAR ( MAX ( 'Table'[Date] ) ) - 1 && MONTH ( 'Table'[date] ) = MONTH ( MAX ( 'Table'[date] ) ) ) )In Matrix 2:
YTD Average Amount = VAR _endMonthDay = EOMONTH ( SELECTEDVALUE ( DateTable[Y&M] ), -1 ) VAR _monthCurrentSelectMonth = MONTH ( SELECTEDVALUE ( DateTable[Y&M] ) ) VAR _startMonthDay = EOMONTH ( SELECTEDVALUE ( DateTable[Y&M] ), -1 * _monthCurrentSelectMonth ) + 1 VAR _result = CALCULATE ( SUM ( 'Table'[amount] ), 'Table'[date] >= _startMonthDay && 'Table'[date] < _endMonthDay ) RETURN AVERAGEX ( FILTER ( ALL ( 'Table' ), 'Table'[date] >= _startMonthDay && 'Table'[date] < _endMonthDay ), CALCULATE ( SUM ( 'Table'[Amount] ) ) )Final output:
How to Get Your Question Answered Quickly - Microsoft Fabric Community
If it does not help, please provide more details with your desired out put and pbix file without privacy information.
Best Regards,
Ada Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Learner27 ,
Unfortunately, I cannot open your sample Pbix file. I create a sample data to help you with your problem.
Sample data:
1.Create a Date Table, and make a relationship between two tables. Put the DateTable into the Slicer.
2.Add new measures.
In Matrix 1:
Current Year number =
CALCULATE (
SUM ( 'Table'[number] ),
FILTER (
ALL ( 'Table'[Date] ),
YEAR ( 'Table'[Date] ) = YEAR ( MAX ( 'Table'[Date] ) )
&& MONTH ( 'Table'[date] ) = MONTH ( MAX ( 'Table'[date] ) )
)
)
Previous Year number =
CALCULATE (
SUM ( 'Table'[number] ),
FILTER (
ALL ( 'Table'[Date] ),
YEAR ( 'Table'[Date] )
= YEAR ( MAX ( 'Table'[Date] ) ) - 1
&& MONTH ( 'Table'[date] ) = MONTH ( MAX ( 'Table'[date] ) )
)
)
In Matrix 2:
YTD Average Amount =
VAR _endMonthDay =
EOMONTH ( SELECTEDVALUE ( DateTable[Y&M] ), -1 )
VAR _monthCurrentSelectMonth =
MONTH ( SELECTEDVALUE ( DateTable[Y&M] ) )
VAR _startMonthDay =
EOMONTH ( SELECTEDVALUE ( DateTable[Y&M] ), -1 * _monthCurrentSelectMonth ) + 1
VAR _result =
CALCULATE (
SUM ( 'Table'[amount] ),
'Table'[date] >= _startMonthDay
&& 'Table'[date] < _endMonthDay
)
RETURN
AVERAGEX (
FILTER (
ALL ( 'Table' ),
'Table'[date] >= _startMonthDay
&& 'Table'[date] < _endMonthDay
),
CALCULATE ( SUM ( 'Table'[Amount] ) )
)
Final output:
How to Get Your Question Answered Quickly - Microsoft Fabric Community
If it does not help, please provide more details with your desired out put and pbix file without privacy information.
Best Regards,
Ada Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Learner272 years agoHelper III
Hi Anonymous
It is wonderful that you have spent time on my query. It was really great, and thank you so much. I have created another post because this is not meeting my requirements.
However, I will use this one for my future needs. Please reply to my new post
and let me know if you can open my PBIX file. I have uploaded the latest PBIX file.Once again, thank you so much!