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
tomascid
Frequent Visitor

Summing measures

 

Hi there - I've created a table visual like that on the left. 'Result' is a measure. I'd like to create a 2nd table where I'm summing the result per facility. But I can't see to figure out what DAX to use - SUM() is only for tables, not measures. Do I need some sort of custom script?

 

FacilityResult FacilitySum of Result
A0.17 A1.96
A0.75 B2.77
A0.25 C1.88
A0.78   
B0.62   
B0.94   
B0.30   
B0.91   
C0.29   
C0.34   
C0.33   
C0.92   
3 REPLIES 3
johnt75
Super User
Super User

You can try

Sum of result =
SUMX ( VALUES ( 'Table'[Facility] ), [Result] )

The issue is that the table on the left is not a PBI data table, it's a table visual I've generated on-the-fly. 'Facility' comes from a table but 'Result' is itself a measure. 

The principal will still work, although you will need to include all the columns from the table visual which uniquely identify a row. In your example there is only facility, but there must be more columns otherwise each row would give the same result.

If you were grouping by facility and month for example you could use

Sum of result =
SUMX ( SUMMARIZE ( 'Table', 'Table'[Facility], 'Table'[Month] ), [Result] )

which will calculate [Result] for each combination of facility and month and then sum them up.

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.

Top Solution Authors