Forum Discussion
tharaujo85
2 years agoFrequent Visitor
Create a Measure which compares a measure with a static table of thresholds
Hello! I want to Create a Measure which compares a measure (PlanCob) with a static table of thresholds and returns a constant (5 i.ex.) on the selected date when it crosses one of the thresholds, as...
- Anonymous2 years ago
Hi tharaujo85
1.You can create a index measure first
Index = RANKX(ALLSELECTED('Table'),CALCULATE(MAX([dat_data])),,ASC))2.Then create the following measure
Measure = var _inde=[Index] var a=MINX(FILTER(ALLSELECTED('Table'),[PlanCob]=SELECTEDVALUE('Table'[PlanCob])),[dat_data]) var b=MINX(FILTER(ALLSELECTED('Table (2)'),[thresholds]>SELECTEDVALUE('Table'[PlanCob])),[thresholds]) var c=MAXX(FILTER(ALLSELECTED('Table'),[Index]=_inde-1),[PlanCob]) var d=MINX(FILTER(ALLSELECTED('Table (2)'),[thresholds]>c),[thresholds]) return IF(SELECTEDVALUE('Table'[dat_data])=a&&b<>d&&ISBLANK(b)=FALSE(),5)Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Anonymous
2 years agoNot applicable
Hi tharaujo85
1.You can create a index measure first
Index = RANKX(ALLSELECTED('Table'),CALCULATE(MAX([dat_data])),,ASC))
2.Then create the following measure
Measure = var _inde=[Index]
var a=MINX(FILTER(ALLSELECTED('Table'),[PlanCob]=SELECTEDVALUE('Table'[PlanCob])),[dat_data])
var b=MINX(FILTER(ALLSELECTED('Table (2)'),[thresholds]>SELECTEDVALUE('Table'[PlanCob])),[thresholds])
var c=MAXX(FILTER(ALLSELECTED('Table'),[Index]=_inde-1),[PlanCob])
var d=MINX(FILTER(ALLSELECTED('Table (2)'),[thresholds]>c),[thresholds])
return IF(SELECTEDVALUE('Table'[dat_data])=a&&b<>d&&ISBLANK(b)=FALSE(),5)
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- tharaujo852 years agoFrequent Visitor
Thank you Anonymous !!!
Very interesting manner to solve it. Took me sometime but understood it.
- tharaujo852 years agoFrequent Visitor
Just didn't understood why create the 'a' variable. I commented it and it worked ok. Do you see any case that it will be necessary?