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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

How to do sum of a measure in Power BI matrix ?

Hi All,

 

I am trying to represent a measure in Matrix format and also want to represent total of measure of each row at the end of the matrix.

 

Measure   =

VAR A   =

     MAXX(Values('Table’ [id]),

       CALCULATE(MAX(‘Table’[Time of arrival]),

        FILTER('Table', [Is Active?]="Yes")))

 

RETURN

MAXX(

    Values(‘Table’ [id]),

    CALCULATE(MAX(‘Table’[person_number]),

    FILTER(’Table’, 'Table'[Time of arrival] = A)))

 

ACTUAL RESULT:

 

JAN

FEB

MAR

APR

MAY

JUN

Group A

1

 

2

4

5

6

Group B

4

5

3

5

 

7

TOTAL

1

 

2

4

5

7

 

EXPECTED RESULT :

 

JAN

FEB

MAR

APR

MAY

JUN

Group A

1

 

2

4

5

6

Group B

4

5

3

5

 

7

TOTAL

5

5

5

9

5

13

 

If you can provide your thoughts or views on this topic that would be really helpful.

Stay safe and healthy !

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a measure like

new meaure = sumx(values(Table[group]),[Measure])

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Try if this works, if not can you provide a data sample that is used for your matrix results

Measure = 
VAR __matrix =
    ADDCOLUMNS(
        SUMMARIZE( 'Table', 'Table'[id], 'Table'[month] ),
        "@maxTimeOfArrival", 
            CALCULATE( 
                MAX( 'Table'[Time of arrival] ),
                'Table'[Is Active?] = "Yes"
            )
    )

RETURN
CALCULATE(
    SUM( ‘Table’[person_number] ),
    TREATAS( 
        __matrix, 
        'Table'[id], 'Table'[month], 'Table'[Time of arrival] 
    )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

amitchandak
Super User
Super User

@Anonymous , Try a measure like

new meaure = sumx(values(Table[group]),[Measure])

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.