Forum Discussion
gandharv
2 years agoFrequent Visitor
Calculated column using DAX
Hi Guys, I need urgent help with the DAX function to calculate column H of the below dummy data table in Power BI. Important to consider : The Formula should consider Column A, B, C, and D as un...
- 2 years ago
Hi, gandharv
in above you mention price-cost and you tack cost-price(f2-e2)so i take as a cost-price(f2-e2) so look at these
try below code with some changes
column= var a = tablename[model_run] var b = tablename[category] var c = tablename[time] var e = tablename[date] return sumx( filter( tablename, tablename[model_run]=a && tablename[category]=b && tablename[time]<= c && tablename[time]=e ), tablename[cost]-tablename[price] )
gandharv
2 years agoFrequent Visitor
Hi Dangar,
Thank you for your help earlier. I have realised some changes in my original dataset, herewith am attaching a screenshot of dummy data which is the actual representation of my real data. Can you pls help me modify the DAX function accordingly? I have manually calculated in Excel for your clear understanding and mentioned the condition as well.
Dangar332
2 years agoResident Rockstar
hi, gandharv
try below
but cross check it before move ahead
Column =
var a =
FILTER('Table (2)',
'Table (2)'[Model_Run]=EARLIER('Table (2)'[Model_Run]) &&
'Table (2)'[Area] = EARLIER('Table (2)'[Area]) &&
'Table (2)'[Date] = EARLIER('Table (2)'[Date]) &&
'Table (2)'[Time]<= EARLIER('Table (2)'[Time])
)
var b = MINX('Table (2)','Table (2)'[Time])
var d = MINX(FILTER('Table (2)','Table (2)'[Time]=b),'Table (2)'[Price - Cost (Value)])
var c = SUMX(a,'Table (2)'[Price - Cost (Value)])-d
return
IF(c<0,0,c)
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.