Forum Discussion
need help in dax
Hi, vipinverma11
Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.
Measures:
spill_over = 'Table'[total labour hours] - 'Table'[WC_hours]
new spill_over =
VAR _laterSecondCell =
CALCULATE (
MAX ( 'Table'[spill_over] ),
FILTER ( 'Table', 'Table'[Index] = EARLIER ( 'Table'[Index] ) - 1 )
)
RETURN
_laterSecondCell
New total labour hours =
CALCULATE (
SUM ( 'Table'[total labour hours] ) + SUM ( 'Table'[new spill_over] )
)
If this does not work, could you please share some sample data without sensitive information and expected output.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Thanks for your help, i have just tweak the formula and added one more filter condition that opworkcentre=earlier[opworkcentre] then i have achieved this
But in this i want to acehieve like if you see the data of 19 jan & 22 jan. So 19th jan spill over that 4.95 it's added in 22 jan labour hours that is 37.97+ 4.95 = 42.92 which is correct which i am getting in the last column.
So after that next step would in next row it will compare new labour hour 42.92 is greater than 35 then 42.92-35 = 7.92 should add in to the 23 jan labour hour 24.4+ 7.92 = 32.32 so in this no spill over so i should get 0, and so on .This process will carry forward.
I am confused is we have to create a calculated column or measure becuase in calculated column the values will be static