The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello guys, im super new on this and i tried to find the solution online without success.
The situation is the following:
We have many items produced by date, on the example below i have the pallet count and i need it to be deducted from previous if the date is the same:
So basically, if is the same date, the following row should deduct from previous on pallet count.
Is there anyway to accomplish this?
Thank you
Solved! Go to Solution.
@MjoGehri
You need to add an index column to your table in Power Query first then add the following column using DAX:
New Count =
VAR __CURRINDEX = 'Table6'[Index]
VAR __CURRDATE = 'Table6'[Date]
VAR __PREVDATE = MAXX( FILTER( 'Table6', Table6[Index] = __CURRINDEX - 1) , 'Table6'[Date] )
VAR __CURRAMT = 'Table6'[Count]
VAR __PREVAMT = MAXX( FILTER( 'Table6', Table6[Index] = __CURRINDEX - 1) , 'Table6'[Count] )
RETURN
SWITCH(
TRUE(),
__CURRDATE = __PREVDATE , __CURRAMT - __PREVAMT,
__CURRAMT
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@MjoGehri
You need to add an index column to your table in Power Query first then add the following column using DAX:
New Count =
VAR __CURRINDEX = 'Table6'[Index]
VAR __CURRDATE = 'Table6'[Date]
VAR __PREVDATE = MAXX( FILTER( 'Table6', Table6[Index] = __CURRINDEX - 1) , 'Table6'[Date] )
VAR __CURRAMT = 'Table6'[Count]
VAR __PREVAMT = MAXX( FILTER( 'Table6', Table6[Index] = __CURRINDEX - 1) , 'Table6'[Count] )
RETURN
SWITCH(
TRUE(),
__CURRDATE = __PREVDATE , __CURRAMT - __PREVAMT,
__CURRAMT
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group