Forum Discussion
SUM Column in Value Exists in Another Table
- 3 years ago
Hi , Anonymous
According to your description, you want to get the sum of [Hours] according to the another table the job type hour > 0.
Here are the steps you can refer to :
(1)My test data is the same as yours.(2)We can create a measure like this:
Measure = var _t =ADDCOLUMNS( ALLSELECTED('Table 1') , "flag" , var _id = [ID] var _job=[Job Type] var _t = FILTER('Table 2' ,'Table 2'[ID] = _id) return IF( OR( _job = "Erect" && MAXX(_t, [Estimate Erect Hours])>0 ,_job = "Dismantle" && MAXX(_t, [Estimate Dismantle Hours])>0 ) , 1, 0)) return SUMX(_t ,IF([flag]=1,[Hours],0))(3)Then we can get the total:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , Anonymous
According to your description, you want to get the sum of [Hours] according to the another table the job type hour > 0.
Here are the steps you can refer to :
(1)My test data is the same as yours.
(2)We can create a measure like this:
Measure = var _t =ADDCOLUMNS( ALLSELECTED('Table 1') , "flag" ,
var _id = [ID] var _job=[Job Type] var _t = FILTER('Table 2' ,'Table 2'[ID] = _id) return
IF( OR( _job = "Erect" && MAXX(_t, [Estimate Erect Hours])>0 ,_job = "Dismantle" && MAXX(_t, [Estimate Dismantle Hours])>0 ) , 1, 0))
return
SUMX(_t ,IF([flag]=1,[Hours],0))
(3)Then we can get the total:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- Anonymous3 years agoNot applicable
Thank you very much for taking the time to solve the problem!
You are a life saver 🙂