Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I need to be able to subtract dates from the same row.
- Specifically, I care only about the date differnce btween the Statuses "SFT" and "REA" and only if they follow each other.
- If "SFT" is nt follwed by "REA", then I don't need the calculation. I deally, I would like for those to be left blank.
- For example, for Equip_Num 367584264, I would like to calculate the Date_Difference between 5/17/2022 and 5/24/2022.
Here is what the table looks like:
Equip_Num | Status | Completed On | Date_Difference |
367584264 | SFT | 5/1/2022 | |
367584264 | RVW | 5/13/2022 | |
367584264 | SFT | 5/17/2022 | |
367584264 | REA | 5/24/2022 | |
367584265 | RVW | 5/11/2022 | |
367584265 | SFT | 5/15/2022 | |
367584265 | REA | 5/20/2022 | |
367584266 | RVW | 5/2/2022 | |
367584266 | SFT | 5/3/2022 |
Thank you!
Solved! Go to Solution.
Hi, @NPC
You can try the following methods.
Column:
Previous Date =
MAXX (
FILTER (
'Table',
[Completed On] < EARLIER ( 'Table'[Completed On] )
&& [Equip_Num] = EARLIER ( 'Table'[Equip_Num] )
),
[Completed On]
)
Previous Status =
CALCULATE (
MAX ( 'Table'[Status] ),
FILTER (
'Table',
[Equip_Num] = EARLIER ( 'Table'[Equip_Num] )
&& [Completed On] = EARLIER ( 'Table'[Previous Date] )
)
)
Follow = IF([Status]="REA"&&[Previous Status]="SFT",1,BLANK())
Date_Difference = IF([Follow]=1,[Completed On]-[Previous Date],BLANK())
Is this the output 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.
Thank you, this works!
Hi, @NPC
You can try the following methods.
Column:
Previous Date =
MAXX (
FILTER (
'Table',
[Completed On] < EARLIER ( 'Table'[Completed On] )
&& [Equip_Num] = EARLIER ( 'Table'[Equip_Num] )
),
[Completed On]
)
Previous Status =
CALCULATE (
MAX ( 'Table'[Status] ),
FILTER (
'Table',
[Equip_Num] = EARLIER ( 'Table'[Equip_Num] )
&& [Completed On] = EARLIER ( 'Table'[Previous Date] )
)
)
Follow = IF([Status]="REA"&&[Previous Status]="SFT",1,BLANK())
Date_Difference = IF([Follow]=1,[Completed On]-[Previous Date],BLANK())
Is this the output 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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
95 | |
94 | |
79 | |
71 | |
64 |
User | Count |
---|---|
120 | |
105 | |
99 | |
81 | |
72 |