Forum Discussion

Daniel_Gatti's avatar
Daniel_Gatti
Regular Visitor
4 years ago
Solved

Sum values between multiple periods

Hello, I have the following model in my Power BI report: My first measure is a simple sum: 01 Total Sale = SUM(fSales[Sale])   What I'm trying to achieve is a measure that calculates the s...
  • tamerj1's avatar
    tamerj1
    4 years ago

    Hi Daniel_Gatti 
    Here is the sample file with the solution https://we.tl/t-wcDtQlG6IL

    99 Total Sale Active Architect = 
    CALCULATE (
        Medidas[01 Total Venda],
        FILTER (
            fSales,
            fSales[Cod Architect] IN
            DISTINCT (
                SELECTCOLUMNS (
                    FILTER (
                        Carteira,
                        Carteira[Start date] <= fSales[Data]
                            && Carteira[End date] >= fSales[Data]
                    ),
                    "@CodArchitect", Carteira[Cod Architect]
                )
            )
        )
    )