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 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
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 |
---|---|
106 | |
104 | |
79 | |
68 | |
61 |
User | Count |
---|---|
144 | |
104 | |
103 | |
82 | |
70 |