Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
PBI_V2
Helper IV
Helper IV

Total should come first column

Hello All,

 

We are looking for a solution where in a matrix we can show total as First. like below

 

 TotalJanFeb
USA1006040

 

 

Thanks,

PBI V2

2 ACCEPTED SOLUTIONS
mlsx4
Super User
Super User

Hi @PBI_V2 

 

As far as I know there is no direct solution, but there are some tricks. Take a look at this link: https://www.youtube.com/watch?v=VRUs0pWgsdE

View solution in original post

eliasayyy
Super User
Super User

its not possible from the format however there is a workaround

lets say this is my table

annonymous1999_0-1691584400959.png


then you need to create a new table that will add "Total" to each country as well as a sorting so total can be in front 

NewTable = 
VAR OriginalWithSort = ADDCOLUMNS(
    SELECTCOLUMNS(
        'Table',
        "Country", [Country],
        "Month", [Month],
        "Amount", [Amount]
    ),
    "SortOrder", SWITCH([Month], "Jan", 2, "Feb", 3, "Mar", 4, "Apr", 5, "May", 6, "Jun", 7, "Jul", 8, "Aug", 9, "Sep", 10, "Oct", 11, "Nov", 12, "Dec", 13, 1)
)

VAR TotalWithSort = SELECTCOLUMNS(
    SUMMARIZE(
        'Table', 
        [Country], 
        "TotalAmount", SUM('Table'[Amount])
    ),
    "Country", [Country],
    "Month", "Total",
    "Amount", [TotalAmount],
    "SortOrder", 1
)

RETURN
UNION(
    OriginalWithSort,
    TotalWithSort
)


now sort the "Month" Column by the "Sort" column 

add the fields in a new table visual from the newly created table above and turn off from format the column subtotal

result


annonymous1999_1-1691584557923.png

 



View solution in original post

4 REPLIES 4
PBI_V2
Helper IV
Helper IV

Hello @eliasayyy ,

Thanks for response, Is there any performance issue with this approch if case we have large volume of dataset.

Hello @mlsx4 

Thanks for response,

Is there any performace issue, we have create many to many relationship between tables in case we have large volume of dataset.

 

Thanks,

PBI V2

hello no it shouldnt create any issues with performance because you are just creating a new table so it is only calculated once 

eliasayyy
Super User
Super User

its not possible from the format however there is a workaround

lets say this is my table

annonymous1999_0-1691584400959.png


then you need to create a new table that will add "Total" to each country as well as a sorting so total can be in front 

NewTable = 
VAR OriginalWithSort = ADDCOLUMNS(
    SELECTCOLUMNS(
        'Table',
        "Country", [Country],
        "Month", [Month],
        "Amount", [Amount]
    ),
    "SortOrder", SWITCH([Month], "Jan", 2, "Feb", 3, "Mar", 4, "Apr", 5, "May", 6, "Jun", 7, "Jul", 8, "Aug", 9, "Sep", 10, "Oct", 11, "Nov", 12, "Dec", 13, 1)
)

VAR TotalWithSort = SELECTCOLUMNS(
    SUMMARIZE(
        'Table', 
        [Country], 
        "TotalAmount", SUM('Table'[Amount])
    ),
    "Country", [Country],
    "Month", "Total",
    "Amount", [TotalAmount],
    "SortOrder", 1
)

RETURN
UNION(
    OriginalWithSort,
    TotalWithSort
)


now sort the "Month" Column by the "Sort" column 

add the fields in a new table visual from the newly created table above and turn off from format the column subtotal

result


annonymous1999_1-1691584557923.png

 



mlsx4
Super User
Super User

Hi @PBI_V2 

 

As far as I know there is no direct solution, but there are some tricks. Take a look at this link: https://www.youtube.com/watch?v=VRUs0pWgsdE

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.