cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Anonymous
Not applicable

## Measure totals do not return expected values

Hi All,

I've a simple measure with 2 variables that calculate the sum/difference of columns from multiple tables and result is set to return min of these 2 variables, It displyed correctly in the table but the total does not show the expected value.

Current output : Min (A+B, C+D) i.e., Min (6,8) = 6

Expected output : Sum of MinResult (1+1) = 2

I need the sum of the final MinResult as in table below

For Ex:

``````# MinResult =
VAR A+B = SUM(Table1[A])+SUM('Table2'[B])
VAR C+D = SUM(Table1[C])+SUM('Table2'[D])
VAR Result =
(
MIN ( (A+B), (C+D))
)
Return Result``````

 A B C D A+B C+D Pseudo value Country Min Result (A+B , C+D) 0 1 2 3 1 5 US1 US 1 3 4 0 1 7 1 US2 US 1

@Ashish_Mathur - could you help plz, Thank You!

1 ACCEPTED SOLUTION
Community Support

Hi, @Anonymous

You may create three measures as follows.

``````AB = SUM('Table'[A])+SUM('Table'[B])

CD = SUM('Table'[C])+SUM('Table'[D])

MinResult =
SUMX(
'Table',
CALCULATE(MIN([AB],[CD]))
)``````

Result:

Best Regards

Allan

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

8 REPLIES 8
Community Support

Hi, @Anonymous

If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.

Best Regards

Allan

Community Support

Hi, @Anonymous

You may create three measures as follows.

``````AB = SUM('Table'[A])+SUM('Table'[B])

CD = SUM('Table'[C])+SUM('Table'[D])

MinResult =
SUMX(
'Table',
CALCULATE(MIN([AB],[CD]))
)``````

Result:

Best Regards

Allan

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you!!

Super User

The information you have provided is not making the problem clear to me. Can you please explain with an example.

refer if you looking for :https://community.powerbi.com/t5/Desktop/SUM-of-AVERAGE/td-p/197013

Anonymous
Not applicable

I'll try to explain the issue better this time

I've a measure to return min of two variables. So, let's say for a given country, i have 2 entries, 1 for each state as below. As expected, measure returns the min values for each state (see below). Now, when i show the total value for column - 'Min value' it is showing 5 instead i.e., it is adding the values for B (5) and comparing it with A (6) and returning the minimum value of the total

 A B State Country Min value of A,B 1 2 Tx US 1 5 3 Ca US 3 Total 5

Super User

Try like

``sumx(summarize(table,table[state],table[country], "_min",min(table[A],table[B])),[_min])``

Anonymous
Not applicable

It is not working.. i tried with sample data and returns the following error

Anonymous
Not applicable

i couldn't upload the pic. I am using the same table as mentioned above

"The syntax for 'Table' is incorrect. (DAX(sumx(summarize (Table,'Table'[State],Table[Country], "_min",min(Table[A],Table[B])) ,[_min])))."

Announcements

#### 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.