Forum Discussion
svendaems
2 years agoFrequent Visitor
Find previous and next date
Hi, I hope somebody can help me with this setup I want to achieve in PowerBI. I've 2 tables, a table tblServers & a table tblWaves. The tblServers lists out all servers & to which wave they bel...
- Anonymous2 years ago
Hi svendaems ,
Thanks for your concern about this case!
svendaems Have you solved your problem? If not, please try this way:
Because today is not May 3rd, so I use May 3rd to test:Previous Patching = VAR PatchingName = tblPatching[Name] VAR RelatedWave = RELATED(tblServers[Wave]) VAR TargetDate = CALCULATE( MINX( FILTER( tblWaves, tblWaves[Wave] = RelatedWave && tblWaves[Date] <= DATE(2024, 5, 3) ), tblWaves[Date] ), ALL(tblWaves) ) RETURN TargetDateNext Patching = VAR PatchingName = tblPatching[Name] VAR RelatedWave = RELATED(tblServers[Wave]) VAR TargetDate = CALCULATE( MINX( FILTER( tblWaves, tblWaves[Wave] = RelatedWave && tblWaves[Date] >= DATE(2024, 5, 3) ), tblWaves[Date] ), ALL(tblWaves) ) RETURN TargetDatePlease change the
DATE(2024, 5, 3)into
TODAY()
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot applicable
Hi svendaems ,
Thanks for your concern about this case!
svendaems Have you solved your problem? If not, please try this way:
Because today is not May 3rd, so I use May 3rd to test:
Previous Patching =
VAR PatchingName = tblPatching[Name]
VAR RelatedWave = RELATED(tblServers[Wave])
VAR TargetDate = CALCULATE(
MINX(
FILTER(
tblWaves,
tblWaves[Wave] = RelatedWave &&
tblWaves[Date] <= DATE(2024, 5, 3)
),
tblWaves[Date]
),
ALL(tblWaves)
)
RETURN TargetDateNext Patching =
VAR PatchingName = tblPatching[Name]
VAR RelatedWave = RELATED(tblServers[Wave])
VAR TargetDate = CALCULATE(
MINX(
FILTER(
tblWaves,
tblWaves[Wave] = RelatedWave &&
tblWaves[Date] >= DATE(2024, 5, 3)
),
tblWaves[Date]
),
ALL(tblWaves)
)
RETURN TargetDate
Please change the
DATE(2024, 5, 3)
into
TODAY()
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
svendaems
2 years agoFrequent Visitor