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.
Hello everyone and please help
MY PROBLEM
In the table "TABLE1" I have the values "id" and "Value". The measure "Value n-1" calculates the value from the previous row of the table. The column "Differ" is a measure that calculates the difference between "Value" and "Value n-1". At the level of a single row in the table, everything is calculated correctly. However, I need to calculate the sum of differences from the column "Differ". The calculated value in the table "Table1" should be "10" but it is "37". The problem probably lies in the lack of a sum of values for the column "Value n-1". What am I doing wrong? Please help
Value n-1 =
var a =
CALCULATE(
max(TABLE1[id]);
FILTER(
ALLSELECTED(TABLE1[id]);TABLE1[id] < SELECTEDVALUE(TABLE1[id])
)
)
RETURN
CALCULATE(
SUMX(TABLE1;TABLE1[Value]);TABLE1[id] = a
)
Differ =
var a = TABLE1[Value n-1]
RETURN
sumx(TABLE1;TABLE1[Value] - a)
Solved! Go to Solution.
Try these measures:
Sum of Value = SUM ( Table1[Value] )
Value n-1 =
CALCULATE (
[Sum of Value],
OFFSET ( -1, ALLSELECTED ( Table1[id] ), ORDERBY ( Table1[id], ASC ) )
)
Differ = [Sum of Value] - [Value n-1]
Proud to be a Super User!
Try these measures:
Sum of Value = SUM ( Table1[Value] )
Value n-1 =
CALCULATE (
[Sum of Value],
OFFSET ( -1, ALLSELECTED ( Table1[id] ), ORDERBY ( Table1[id], ASC ) )
)
Differ = [Sum of Value] - [Value n-1]
Proud to be a Super User!
Thank you very much for your support
everything works fine
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
8 | |
8 |