Forum Discussion

fonsogijon's avatar
fonsogijon
Frequent Visitor
2 years ago
Solved

Running total with Fact, Date and Dim table

I'm trying to calculate a running total, I've tried window function and the standard way of calculating using dax, but it is not working. Let me explain my scenario: I have a Calendar table, a di...
  • Anonymous's avatar
    Anonymous
    2 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