Forum Discussion
Anonymous
2 years agoNot applicable
Running Stockpile total
I am trying to get a stockpile balance using Power BI. I have 4 columns in my sample table with this data. I would like to add a column that will show me the current stockpile balance. This runnin...
- 2 years ago
Hi,
I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file whether it suits your requirement.
It is for creating a new calculated column.
expected result CC = VAR _lastnonblankdate = MAXX ( FILTER ( Data, Data[date] <= EARLIER ( Data[date] ) && Data[stockpilesurveytons] <> BLANK () ), Data[date] ) RETURN SUMX ( FILTER ( Data, Data[date] = _lastnonblankdate ), Data[stockpilesurveytons] ) + SUMX ( FILTER ( Data, Data[date] >= _lastnonblankdate && Data[date] <= EARLIER ( Data[date] ) ), Data[tonstostockpile] ) - SUMX ( FILTER ( Data, Data[date] >= _lastnonblankdate && Data[date] <= EARLIER ( Data[date] ) ), Data[tonsfromstockpile] )
Jihwan_Kim
Super User
2 years agoHi,
I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file whether it suits your requirement.
It is for creating a new calculated column.
expected result CC =
VAR _lastnonblankdate =
MAXX (
FILTER (
Data,
Data[date] <= EARLIER ( Data[date] )
&& Data[stockpilesurveytons] <> BLANK ()
),
Data[date]
)
RETURN
SUMX (
FILTER ( Data, Data[date] = _lastnonblankdate ),
Data[stockpilesurveytons]
)
+ SUMX (
FILTER (
Data,
Data[date] >= _lastnonblankdate
&& Data[date] <= EARLIER ( Data[date] )
),
Data[tonstostockpile]
)
- SUMX (
FILTER (
Data,
Data[date] >= _lastnonblankdate
&& Data[date] <= EARLIER ( Data[date] )
),
Data[tonsfromstockpile]
)