Forum Discussion

char23's avatar
char23
Helper II
2 years ago
Solved

How to stack or group table with related data

Hello, the table at the top below shows how I currently have a table visual in my file. The info in the table is pulled from a variety of sources (some from various tables and some from measures). Is there a way I can stack or group related items in a table so I can have the percentages show under the actual value (example on bottom table)? This would help in formatting my dashboard. 

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    amitchandak Thanks for your contribution on this thread.

    Hi char23 ,

    I created a sample pbix file(see the attachment), please check if that is what you want.

    1. Create a status dimension table 

    2. Create two measures as below

    Measure =
    VAR _status =
        SELECTEDVALUE ( 'Status'[Status] )
    RETURN
        SWITCH (
            _status,
            "Completed", SUM ( 'Table'[Completed] ),
            "Not Finished", SUM ( 'Table'[Not Finished] ),
            "Late", SUM ( 'Table'[Late] )
        )
    Measure% = 
    VAR _status =
        SELECTEDVALUE ( 'Status'[Status] )
    RETURN
        SWITCH (
            _status,
            "Completed",
                DIVIDE (
                    SUM ( 'Table'[Completed] ),
                    CALCULATE ( SUM ( 'Table'[Completed] ), ALLSELECTED ( 'Table'[Month] ) )
                ),
            "Not Finished",
                DIVIDE (
                    SUM ( 'Table'[Not Finished] ),
                    CALCULATE ( SUM ( 'Table'[Not Finished] ), ALLSELECTED ( 'Table'[Month] ) )
                ),
            "Late",
                DIVIDE (
                    SUM ( 'Table'[Late] ),
                    CALCULATE ( SUM ( 'Table'[Late] ), ALLSELECTED ( 'Table'[Month] ) )
                )
        )

    3. Create a matrix visual

    Best Regards

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    amitchandak Thanks for your contribution on this thread.

    Hi char23 ,

    I created a sample pbix file(see the attachment), please check if that is what you want.

    1. Create a status dimension table 

    2. Create two measures as below

    Measure =
    VAR _status =
        SELECTEDVALUE ( 'Status'[Status] )
    RETURN
        SWITCH (
            _status,
            "Completed", SUM ( 'Table'[Completed] ),
            "Not Finished", SUM ( 'Table'[Not Finished] ),
            "Late", SUM ( 'Table'[Late] )
        )
    Measure% = 
    VAR _status =
        SELECTEDVALUE ( 'Status'[Status] )
    RETURN
        SWITCH (
            _status,
            "Completed",
                DIVIDE (
                    SUM ( 'Table'[Completed] ),
                    CALCULATE ( SUM ( 'Table'[Completed] ), ALLSELECTED ( 'Table'[Month] ) )
                ),
            "Not Finished",
                DIVIDE (
                    SUM ( 'Table'[Not Finished] ),
                    CALCULATE ( SUM ( 'Table'[Not Finished] ), ALLSELECTED ( 'Table'[Month] ) )
                ),
            "Late",
                DIVIDE (
                    SUM ( 'Table'[Late] ),
                    CALCULATE ( SUM ( 'Table'[Late] ), ALLSELECTED ( 'Table'[Month] ) )
                )
        )

    3. Create a matrix visual

    Best Regards