Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Everyone,
I am looking to calculate the marginal product count to understand where we're seeing diminishing returns.
I have two columns of data - Days (which is a calculated DateDiff column I built in the table) and Product Count (which is a measure I created -- counting incidences of the sale of Product X).
I've seen a lot of solutions for calculating a running difference between current row and previous row where the row data is coming from calculated column in the table, but not where the row level data is a measure -- any help would be greatly appreciated!
Product Sales Data --
Day (Calc Column in Table) Product Count (Measure) Marginal Product Count
0 10
1 12 2
2 20 8
And so on...
Thank you!
Solved! Go to Solution.
Hi, @samdep
Please check the below picture and the link down below (sample pbix file) whether it is what you are looking for.
The measure is in the sample pbix file.
Diff qty count =
VAR currentnumber =
MAX ( 'Table'[Day Calc Column] )
VAR onerowbefore =
CALCULATE (
MAX ( 'Table'[Day Calc Column] ),
FILTER ( ALL ( 'Table' ), 'Table'[Day Calc Column] < currentnumber )
)
VAR onerowbeforeqty =
CALCULATE ( [total qty], 'Table'[Day Calc Column] = onerowbefore )
RETURN
IF ( NOT ISBLANK ( onerowbeforeqty ), [total qty] - onerowbeforeqty, BLANK () )
https://www.dropbox.com/s/afahpn09tch8lii/samdep.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Hi Jihwan,
This worked perfectly! Thank you so much for your help!!
Hi, @samdep
Please check the below picture and the link down below (sample pbix file) whether it is what you are looking for.
The measure is in the sample pbix file.
Diff qty count =
VAR currentnumber =
MAX ( 'Table'[Day Calc Column] )
VAR onerowbefore =
CALCULATE (
MAX ( 'Table'[Day Calc Column] ),
FILTER ( ALL ( 'Table' ), 'Table'[Day Calc Column] < currentnumber )
)
VAR onerowbeforeqty =
CALCULATE ( [total qty], 'Table'[Day Calc Column] = onerowbefore )
RETURN
IF ( NOT ISBLANK ( onerowbeforeqty ), [total qty] - onerowbeforeqty, BLANK () )
https://www.dropbox.com/s/afahpn09tch8lii/samdep.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |