Forum Discussion
axk180022
4 years agoHelper II
Calculate Difference between 2 rows based on another column filter
I would want to find the difference in the GenHours for each serialid. Currently this is how my table looks on power BI. I have filtered the latest and 2nd latest date for each serialid.
Now i would want to find the difference between the GenHours that is being diplayed on Power BI.
Can someone please help.
Hi,
This calculated column formula works
=if(CALCULATE(MAX(Data[Dates]),FILTER(Data,Data[serialid]=EARLIER(Data[serialid])))=Data[Dates],ABS(Data[GenHours]-LOOKUPVALUE(Data[GenHours],Data[Dates],CALCULATE(max(Data[Dates]),FILTER(Data,Data[serialid]=EARLIER(Data[serialid])&&Data[Dates]<EARLIER(Data[Dates]))),Data[serialid],Data[serialid])),BLANK())Hope this helps.
25 Replies
- richbenmintzResident Rockstar
Hi axk180022,
Are you able to provide the data as a table as opposed to an image and the expected outcome. Not sure I understand the requirement based on your post.
Thanks,
- axk180022Helper II
The one highlighted is the output I require, Which is the difference of GenHours between 2 latest dates.
- richbenmintzResident Rockstar
- Syndicate_AdminAdministrator
This sent me to my analysis.
Thank you!
- Syndicate_AdminAdministrator
This sent me to my analysis.
Thank you!