Forum Discussion
Return Value from Table based on Measure Condition
- 5 years ago
I did think it was a column. Here is a different expresssion that works with a measure. Just replace 0.1 with 0.9 for the other measure.
10 Pct Month =
VAR summary =
ADDCOLUMNS (
SUMMARIZE (
Data,
Data[Project],
Data[Location],
Data[Month]
),
"@PctComplete", [% Complete Measure]
)
RETURN
MINX (
FILTER (
summary,
[@PctComplete] >= 0.1
),
Data[Month]
)Regards,
Pat
Apologies daxer-almighty - i did not get the right result, but probably because my DATA TABLE was incorrect. Sorrt about that... I have another column "Location"
So For Project A Location 1, the Result should be 2 for 10%
So For Project A Location 1, the Result should be 4 for 90%
So For Project A Location 2, the Result should be 3 for 10%
So For Project A Location 2, the Result should be 5 for 90%
| TABLE : DATA | |||
| Project | Location | % Complete | Month |
| A | 1 | 5% | 1 |
| A | 1 | 12% | 2 |
| A | 1 | 50% | 3 |
| A | 1 | 90% | 4 |
| A | 1 | 100% | 5 |
| A | 2 | 10% | 3 |
| A | 2 | 80% | 4 |
| A | 2 | 90% | 5 |
| A | 2 | 100% | 7 |
This measure expression has both expression you'll need as two variable, and concatenates them together in the Return. If you need them separate, you can just Return either the month10 or month90 variables.
10 to 90 Months =
VAR month10 =
CALCULATE (
MIN ( Data[Month] ),
Data[% Complete] >= 0.1
)
VAR month90 =
CALCULATE (
MIN ( Data[Month] ),
Data[% Complete] >= 0.9
)
RETURN
"10% Month - " & month10 & " 90% Month - " & month90
Regards,
Pat
- hackfifi5 years agoHelper V
mahoneypat - Thank you for responding.
I used the below "measure" calculation as per your suggestion, and i get the error message: A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.Kindly note the "% Complete" is a calculated measure; and not part of the table.
10% Months_No =VAR month10 =CALCULATE (MIN ( 'Data'[Period] ),[% Complete]>=0.1)RETURNmonth10- mahoneypat5 years agoMicrosoft Employee
I did think it was a column. Here is a different expresssion that works with a measure. Just replace 0.1 with 0.9 for the other measure.
10 Pct Month =
VAR summary =
ADDCOLUMNS (
SUMMARIZE (
Data,
Data[Project],
Data[Location],
Data[Month]
),
"@PctComplete", [% Complete Measure]
)
RETURN
MINX (
FILTER (
summary,
[@PctComplete] >= 0.1
),
Data[Month]
)Regards,
Pat