Forum Discussion
Return Value from Table based on Measure Condition
Hi - I am trying to return the column value "Month" based on Measure (% Complete)
In the example below, i would like to return the "MONTH" when a "Project" reaches 10% and 90%
Hence in the example below, For Project A i would like to return the value Month = 2 (For 10%) & Month = 5 (For 90%)
I tried the below measure and it did not work
Cheers
| TABLE : DATA | ||
| Project | % Complete | Month |
| A | 5% | 1 |
| A | 12% | 2 |
| A | 30% | 3 |
| A | 80% | 4 |
| A | 90% | 5 |
| A | 100% | 6 |
| B | 8% | 1 |
| B | 9% | 2 |
| B | 15% | 3 |
| B | 25% | 4 |
| B | 55% | 5 |
| B | 75% | 6 |
| B | 85% | 7 |
| B | 90% | 8 |
| B | 100% | 9 |
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
5 Replies
- daxer-almightySolution Sage
[10% Month] = // For the other measure, // just change the __perc var __perc = .1 return if( hasonefilter( T[Project] ), calculate( minx( filter( T, T[% Complete] >= __perc ), T[Month] ), allexcept( T, T[Project] ) ) )- hackfifiHelper V
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 - mahoneypatMicrosoft Employee
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 - " & month90Regards,
Pat