Forum Discussion
Daniel_Gatti
4 years agoRegular Visitor
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...
- 4 years ago
Hi Daniel_Gatti
Here is the sample file with the solution https://we.tl/t-wcDtQlG6IL99 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] ) ) ) )
tamerj1
4 years agoCommunity Champion
Hi Daniel_Gatti
Please try
99 Total Sale Active Architect =
VAR CurrentDate =
MAX ( dCalendar[Date] )
VAR Carteira_Arquitetos =
DISTINCT (
SELECTCOLUMNS (
FILTER (
Carteira,
Carteira[Start date] <= CurrentDate
&& Carteira[End date] <= CurrentDate
),
"@CodArchitect", Carteira[Cod Architect]
)
)
RETURN
CALCULATE (
Medidas[01 Total Sale],
fSales[Cod Architect] IN Carteira_Arquitetos
)- Daniel_Gatti4 years agoRegular Visitor
Hello tamerj1
I didn't worked. The result is still showing 3500, when it should be 1500, because ADRIANA C was not active between 01/02/2022 till 28/02/2022
Here's the link for the file:
https://drive.google.com/file/d/1_HGHM9_f2qkyVGRtQZSVN3WmF_tbakIj/view?usp=sharing
- tamerj14 years agoCommunity Champion
Hi Daniel_Gatti
Here is the sample file with the solution https://we.tl/t-wcDtQlG6IL99 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] ) ) ) )- Daniel_Gatti4 years agoRegular Visitor
thank you so much!😀