Forum Discussion

rveerasamy's avatar
rveerasamy
Helper III
5 years ago

Matrix Visual

In matrix table visualization we have account name added in row fields, sales amount added in values , Category (mettal, robots) added in column fields. So the sales values splitted into mettal and robots. We want to display count of fleet id next to account name column, Can you please guide is there any possibility or workarounds?

3 Replies

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Community Support

    Hi, rveerasamy ;

    You could create a new column to add a “Fleet id" row ,then create a measure as follows:

    1.create a new table

    new =
    VAR _cate =
        SUMMARIZE ( 'Table', [ Category] )
    VAR _fleet =
        SUMMARIZE ( 'Table', "Category", "Fleet id" )
    RETURN
        UNION ( _cate, _fleet )
    

    2.new measure

    Measure =
    VAR _count =
        CALCULATE (
            COUNT ( 'Table'[ID] ),
            ALLEXCEPT ( 'Table', 'Table'[account name] ))
    VAR _sum =
        CALCULATE (
            SUM ( [sales amount ] ),
            FILTER (
                ALLEXCEPT ( 'Table', 'Table'[account name] ),
                [ Category] = MAX ( 'new'[ Category] )))
    VAR _value =
        IF ( MAX ( 'new'[ Category] ) = "Fleet id", _count, _sum )
    RETURN
        IF (
            HASONEVALUE ( 'new'[ Category] ),
            _value,
            CALCULATE (
                SUM ( [sales amount ] ),
                ALLEXCEPT ( 'Table', 'Table'[account name] )
            ) + _count)
    

    The final output is shown below:

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Community Support

    Hi, rveerasamy ;

    Is the above answer helpful to you? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.