Forum Discussion
Bimster
9 years agoFrequent Visitor
compounding values for dates
Hi all, hope someone can help me with my query. I'm a PowerBI newbie so nay help would be great. My manager has a spreadsheet that he wishes me to duplicate within Power BI. This spreadsheet's first...
- Anonymous9 years ago
Bimster,
Firstly, unpivot your columns in your table, rename the blank column to "Stock".
Secondly, create a column using the DAX below.
Column = CALCULATE(SUM(Table[Value]),ALLEXCEPT(Table,Table[Stock]),Table[Attribute]<=EARLIER(Table[Attribute]))
Thirdly, create a Matrix visual as shown in the following capture.
Regards,
Lydia
Bimster
9 years agoFrequent Visitor
Hi MFelix,
The formula is good but I don't think it's quite right for what I need. The data for 03/06/2017 should be (for each stock) the figure calculated for 02/06/2017 (i.e. sum of 01/06/2017's value and 02/06/2017's value) added to the figure for 03/06/2017
| 01/06/2017 | 02/06/2017 | 03/06/2017 | |
| Stock 1 | 10 | 30 | 53 |
| Stock 2 | 15 | 25 | 34 |
MFelix
9 years agoSuper User
Try this change in the formula:
Stock_Value =
VAR min_date =
MIN ( Stocks[Date] )
RETURN
CALCULATE ( SUM ( Stocks[Value] ), Stocks[Date] <= min_date )
Regards,
MFelix