Forum Discussion

user01's avatar
user01
Icon for Resolver I rankResolver I
3 years ago
Solved

Bring in value from one table into another

I have two tables (pseries, data_sample). I bring in data_sample via DirectQuery. Basically, I want to bring in the Target value from data_sample into the table pseries in the same range as data_sample. For example, the Target value is defined for Percentiles 99, 99.2, 99.4, 99.6 in data_sample. Then for the table pseries, for all pseries values between 99 and 99.6 (inclusive), I want the Target value to be the same as data_sample, and for all pseries values outside of [99, 99.6] I want the Target value to be 0. How can I accomplish this?

 

pseries:

 

pseries = GENERATESERIES(0, 100, 0.1)

 

data_sample:

PercentilesValue1Value2Target
1000 
2500 
5010 
7572 
903311 
959336 
98259121 
994622731,400
99.25163351,400
99.46924181,400
99.68215241,400
99.81,136851 
99.91,3151,085 
99.991,932891 

 

Desired result (truncated table to save space):

 

pseriestarget
98.80
98.90
991400
99.11400
99.21400
99.31400
99.41400
99.51400
99.61400
99.70
99.80
99.90
1000
  • Hi, user01 

     

    You can try the following methods.
    Column:

    Target = 
    Var _MinPercentiles=CALCULATE(MIN(data_sample[Percentiles]),FILTER(data_sample,[Target]<>BLANK()))
    Var _MaxPercentiles=CALCULATE(MAX(data_sample[Percentiles]),FILTER(data_sample,[Target]<>BLANK()))
    Return
    IF([pseries]>=_MinPercentiles&&[pseries]<=_MaxPercentiles,MAX(data_sample[Target]))+0

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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

2 Replies

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, user01 

     

    You can try the following methods.
    Column:

    Target = 
    Var _MinPercentiles=CALCULATE(MIN(data_sample[Percentiles]),FILTER(data_sample,[Target]<>BLANK()))
    Var _MaxPercentiles=CALCULATE(MAX(data_sample[Percentiles]),FILTER(data_sample,[Target]<>BLANK()))
    Return
    IF([pseries]>=_MinPercentiles&&[pseries]<=_MaxPercentiles,MAX(data_sample[Target]))+0

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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