Forum Discussion
Running total with Fact, Date and Dim table
- Anonymous2 years ago
Hi fonsogijon ,
You can create a measure as below to get it:
Measure = VAR _dim1 = SELECTEDVALUE ( 'Dim'[Dim1] ) VAR _dim2 = SELECTEDVALUE ( 'Dim'[Dim2] ) VAR _date = SELECTEDVALUE ( 'Calendar'[Date] ) RETURN SUMX ( FILTER ( ALLSELECTED ( 'Facttable' ), 'Facttable'[Dim1] = _dim1 && 'Facttable'[Dim2] = _dim2 && 'Facttable'[Date] <= _date ), [Projected] )If the above one can't help you figure out, please provide some raw data in your dimension table and fact table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
I just cannot relate the table you posted in the first message with the table in the PBI file. Just completely confused.
The mapping would be the following:
| TABLE | PBI |
| Year | Year |
| Month | Month |
| Dim1 | Plant_cd |
| Dim2 | Material_cd |
| Didn't include because did not consider relevant | Inv On hand |
| Measure_Fact1 | OpenProdOrder |
| Measure_Fact2 | Forecast CM |
| Projected | ProjectedInventory |
| Goal Acc Sum | No column, running total of the Projected Inventory (last column in table) by every dim |
PBI file I have, more dim columns, because they can be selected in the parameter.
The goal is to calculate the running total of the Projected Inventory (last column in table) by every dim. If it is confusing I can remove table from example and just add the link to the file.
Thanks!