Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello dear Power BI Community
Following problem:
I would like to add in Power BI the 3th column given these informations:
It should calculate the date difference per Product off the row above.
Product | Date | Date_Difference_per_Product |
A | 01.06.2022 | 0 |
B | 09.06.2022 | 0 |
A | 10.06.2022 | 9 |
A | 15.06.2022 | 5 |
B | 20.06.2022 | 11 |
B | 25.06.2022 | 5 |
Thank you very much for your contribution.
Cheers
qwertzuiop
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
It is for creating a new column.
Date Diff per Product CC =
VAR _previousdate =
MAXX (
FILTER (
Data,
Data[Product] = EARLIER ( Data[Product] )
&& Data[Date] < EARLIER ( Data[Date] )
),
Data[Date]
)
RETURN
IF ( _previousdate = BLANK (), 0, INT ( Data[Date] - _previousdate ) )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
@qwertzuiop try this
Column = var _A = 'yourTable'[Product]
var _B = CALCULATE(MAX('yourTable'[Date]),FILTER('yourTable','yourTable'[Date] <EARLIER('yourTable'[Date])),'yourTable'[Product] = _A)
var _C = DATEDIFF('yourTable'[Date],_B,DAY)
return
if(_C = BLANK(),0,abs(_C)
Hi,
Please check the below picture and the attached pbix file.
It is for creating a new column.
Date Diff per Product CC =
VAR _previousdate =
MAXX (
FILTER (
Data,
Data[Product] = EARLIER ( Data[Product] )
&& Data[Date] < EARLIER ( Data[Date] )
),
Data[Date]
)
RETURN
IF ( _previousdate = BLANK (), 0, INT ( Data[Date] - _previousdate ) )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Dear Jihwan_Kim
User | Count |
---|---|
122 | |
69 | |
67 | |
58 | |
52 |
User | Count |
---|---|
187 | |
94 | |
67 | |
63 | |
54 |