Forum Discussion
Help with Matrix table visual
- 5 months ago
harshadrokade Ok no problem. Here you are:
You can find the updated pbix attached.
Don't forget to accept the solution if this solve your issue π
Hi harshadrokade,
I looked this up in AI and got this:
β
Prerequisites (Data Model)
1οΈβ£ Fact Table (your data)
Fields:
MIS_date
Dept
Category1
Rating Old
Rating New
2οΈβ£ Rating Master (dimension)
You already have this β
RatingWeightR1100R299R398R497R596R695R794R893D(lowest β optional set like 0)
β
Relationships
Rating Master[Rating] β Fact[Rating Old]
Rating Master[Rating] β Fact[Rating New]
(second relationship inactive)
β
Core Measure (Movement Count)
This measure powers every rating column (R1β¦R8, D).
Movement Count :=
VAR OldRating =
SELECTEDVALUE ( 'Fact'[Rating Old] )
VAR NewRating =
SELECTEDVALUE ( 'Rating Master'[Rating] )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'Fact'[Category1] ),
'Fact'[Rating Old] = OldRating,
'Fact'[Rating New] = NewRating
)
β Total Column
Total :=
CALCULATE (
DISTINCTCOUNT ( 'Fact'[Category1] ),
ALLEXCEPT (
'Fact',
'Fact'[MIS_date],
'Fact'[Rating Old]
)
)
β
D / Total Column
D / Total :=
DIVIDE (
CALCULATE (
DISTINCTCOUNT ( 'Fact'[Category1] ),
'Fact'[Rating New] = "D"
),
[Total]
)
β
Stable Count
(Rating Old = Rating New)
Stable :=
CALCULATE (
DISTINCTCOUNT ( 'Fact'[Category1] ),
'Fact'[Rating Old] = 'Fact'[Rating New]
)
β
Upgrade Count (Lower β Higher Weight)
Upgrade :=
VAR OldWeight =
LOOKUPVALUE (
'Rating Master'[Weight],
'Rating Master'[Rating], SELECTEDVALUE ( 'Fact'[Rating Old] )
)
RETURN
CALCULATE (
DISTINCTCOUNT ( 'Fact'[Category1] ),
FILTER (
'Fact',
LOOKUPVALUE (
'Rating Master'[Weight],
'Rating Master'[Rating], 'Fact'[Rating New]
) > OldWeight
)
)
β
Downgrade Count (Higher β Lower Weight)
Downgrade :=
VAR OldWeight =
LOOKUPVALUE (
'Rating Master'[Weight],
'Rating Master'[Rating], SELECTEDVALUE ( 'Fact'[Rating Old] )
)
RETURN
CALCULATE (
DISTINCTCOUNT ( 'Fact'[Category1] ),
FILTER (
'Fact',
LOOKUPVALUE (
'Rating Master'[Weight],
'Rating Master'[Rating], 'Fact'[Rating New]
) < OldWeight
)
)
β
Matrix Visual Configuration (Very Important)
Rows
MIS_date
Rating Old
Columns
Rating Master[Rating]
(this creates R1β¦R8β¦D columns automatically)
Values
Movement Count
Total
D / Total
Stable
Upgrade
Downgrade
β Set βShow items with no data = Onβ for Ratings.
β Performance Notes (This Matters at Scale)
Use integer weights, not text comparisons
Keep Rating Master small
Avoid calculated tables
All measures are fully slicerβaware