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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
PowerMan1
Frequent Visitor

Sum In One Measure

I have two variables and want to sum in one Measure.

VAR Filter1 = { 196, 176, 137, 167, 171, 141, 160, 161 }
VAR Filter2 = { 145, 121 }
VAR FIlter3 = { 2065, 178, 138, 189, 148, 149, 190, 164, 2578, 2778, 2878, 194, 169 }


VAR Income =
CALCULATE (
[Income],
DATESMTD ( 'Date'[Date] ),
FILTER (
OrganizationDepartment_LookUP,
NOT ( OrganizationDepartment_LookUP[CODE] ) IN Filter1 &&
NOT ( OrganizationDepartment_LookUP[CODE] ) IN Filter2 &&
NOT ( OrganizationDepartment_LookUP[CODE] ) IN Filter3 ) )

VAR HoureTarget =
CALCULATE (
CALCULATE (
SUMX (
DoctorTarget,
DoctorTarget[TARGET] * CALCULATE ( [RealTime], DATESMTD ( 'Date'[Date] ) ) ),
FILTER (
OrganizationDepartment_LookUP,
NOT ( OrganizationDepartment_LookUP[CODE] ) IN Filter1 &&
NOT ( OrganizationDepartment_LookUP[CODE] ) IN Filter2 &&
NOT ( OrganizationDepartment_LookUP[CODE] ) IN Filter3)),
TREATAS (
SUMMARIZE ( 'Date', 'Date'[Year], 'Date'[Month Number] ),
DoctorTarget[YEAR],
DoctorTarget[MONTH] ) )

RETURN CALC4 = IF ( HoureTarget = BLANK(), Income, HoureTarget )

My result is sum, but it is not correct. this tree values which is "result true" does not add at the department level:

photo.png

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @PowerMan1 

 

Not sure if I understand your expected result correctly. Do you want to add up the total of all sub values and show it on the subtotal row? If so, you can try the following measure:

measure2 = SUMX ( VALUES ( 'Table'[Code] ), [your original measure] )

vjingzhang_0-1680056927340.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @PowerMan1 

 

Not sure if I understand your expected result correctly. Do you want to add up the total of all sub values and show it on the subtotal row? If so, you can try the following measure:

measure2 = SUMX ( VALUES ( 'Table'[Code] ), [your original measure] )

vjingzhang_0-1680056927340.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.