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
TIA, for your help
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!
Solved! Go to Solution.
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario.
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.
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
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario.
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.
Thank you!!
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
Appreciate your Kudos.
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 |
Try like
sumx(summarize(table,table[state],table[country], "_min",min(table[A],table[B])),[_min])
It is not working.. i tried with sample data and returns the following error
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])))."
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!
User | Count |
---|---|
107 | |
74 | |
66 | |
49 | |
48 |
User | Count |
---|---|
164 | |
87 | |
77 | |
70 | |
67 |