Forum Discussion

jmfillman's avatar
jmfillman
Helper I
3 years ago
Solved

Matrix Challenges

The Matrix visual is something I am really struggling to understand in relation to my data, and after days of trying, I cannot get what I need. I have a Pro, not Enterprise account.   I have 4 tabl...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi jmfillman ,

     

    Here I suggest you to create three dim tables to help you calculating.

    My Test:

    DimGroup = FILTER(DISTINCT(UNION(VALUES('Approved Plan'[Group]),VALUES('Requested Plan'[Group]))),[Group]<>BLANK())
    DimQuarter = FILTER(DISTINCT(UNION(VALUES('Approved Plan'[Fiscal Quarter]),VALUES('Requested Plan'[Fiscal Quarter]))),[Fiscal Quarter]<>BLANK())
    DimYear = FILTER(DISTINCT(UNION(VALUES('Approved Plan'[Fiscal Year]),VALUES('Requested Plan'[Fiscal Year]))),[Fiscal Year]<>BLANK())

    Measures:

    Approved = 
    CALCULATE (
        SUM ( 'Approved Plan'[Approved Hour] ),
        FILTER (
            'Approved Plan',
            'Approved Plan'[State] = "Approved"
                && 'Approved Plan'[Group] = MAX ( DimGroup[Group] )
                && 'Approved Plan'[Fiscal Year] = MAX ( DimYear[Fiscal Year] )
                && 'Approved Plan'[Fiscal Quarter] = MAX ( DimQuarter[Fiscal Quarter] )
        )
    )
    Planned = 
    CALCULATE (
        SUM ( 'Requested Plan'[Planned Hour] ),
        FILTER (
            'Requested Plan',
            'Requested Plan'[State] = "Planned"
                && 'Requested Plan'[Group] = MAX ( DimGroup[Group] )
                && 'Requested Plan'[Fiscal Year] = MAX ( DimYear[Fiscal Year] )
                && 'Requested Plan'[Fiscal Quarter] = MAX ( DimQuarter[Fiscal Quarter] )
        )
    )
    Requested = 
    CALCULATE (
        SUM ( 'Requested Plan'[Planned Hour] ),
        FILTER (
            'Requested Plan',
            'Requested Plan'[State] = "Requested"
                && 'Requested Plan'[Group] = MAX ( DimGroup[Group] )
                && 'Requested Plan'[Fiscal Year] = MAX ( DimYear[Fiscal Year] )
                && 'Requested Plan'[Fiscal Quarter] = MAX ( DimQuarter[Fiscal Quarter] )
        )
    )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.