The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi, Has anyone a idea how to solve this situation in DAX.
In Excel it is quite easy becasue you can always refer to a specific cell.
I need to increment the A Value by B Value, and if A is Blank the A increment should happen by the previous result of the calculation.
Thank You in advance!
I have my data setup like so (actually the 550 in the data isn't used at all, i just need the starting values for A and B and the number of rows to go up to... and the row and the starting values don't even need to be in the same table):
And then a measure:
Sum of A =
var firstAValue = CALCULATE(MIN(Cumulative[A]), Cumulative[Row] = 0)
var firstBValue = CALCULATE(MIN(Cumulative[B]), Cumulative[Row] = 0)
var currentRow = SELECTEDVALUE(Cumulative[Row])
var result = firstAValue * IF(currentRow = 0, 1, currentRow) + (firstBValue * (IF(currentRow = 0, 1, currentRow) - 1))
RETURN result
which you can adapt to get the value for B
Hi vicky_
Thank you for your help.
However it is still not working:
Any idea why this could fail?
PS. I made the same calculation on hard pasted data and it seems to work.
Above a have a summarisecolumn table.
I have my data setup like so (actually the 550 in the data isn't used at all, i just need the starting values for A and B and the number of rows to go up to... and the row and the starting values don't even need to be in the same table):
And then a measure:
Sum of A =
var firstAValue = CALCULATE(MIN(Cumulative[A]), Cumulative[Row] = 0)
var firstBValue = CALCULATE(MIN(Cumulative[B]), Cumulative[Row] = 0)
var currentRow = SELECTEDVALUE(Cumulative[Row])
var result = firstAValue * IF(currentRow = 0, 1, currentRow) + (firstBValue * (IF(currentRow = 0, 1, currentRow) - 1))
RETURN result
which you can adapt to get the value for B
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |