Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I'm having a problem filtering this measure with the DATESBETWEEN.
How can I fix this measure, and what's the issue?
VAR DATAMAX = CALCULATE( LASTDATE(RE[Data]), RE[Informações] = "Contratos Negociados" ) VAR RESULT = CALCULATE( SUM(RE[Valor]), RE[Informações] = "Contratos Negociados", DATESBETWEEN( RE[Data], LASTDATE( DATEADD(RE[Data], -12, MONTH ) ), DATAMAX ) ) RETURN RESULT |
Table:
I need some of the last thirteen months' average that is 102.
But this measure it's returning 56 as result (it's some of the last six values).
Solved! Go to Solution.
Hi @John_Silva642 ,
Transpose table in power query, convert the data model formed by the date column. After testing the following code, the results returned are correct. Can you provide more information or test data so that I can answer your questions as soon as possible.
sum_total =
VAR DATAMAX =
CALCULATE ( LASTDATE ( 'RE'[Date] ), 'RE'[Informações] = "Contratos Negociados" )
VAR RESULT =
CALCULATE (
SUM ( 'RE'[Value] ),
'RE'[Informações] = "Contratos Negociados",
DATESBETWEEN (
'RE'[Date],
LASTDATE ( DATEADD ( 'RE'[Date], -13, MONTH ) ),
DATAMAX
)
)
RETURN
RESULT
Best Regards,
Stephen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @John_Silva642 ,
Transpose table in power query, convert the data model formed by the date column. After testing the following code, the results returned are correct. Can you provide more information or test data so that I can answer your questions as soon as possible.
sum_total =
VAR DATAMAX =
CALCULATE ( LASTDATE ( 'RE'[Date] ), 'RE'[Informações] = "Contratos Negociados" )
VAR RESULT =
CALCULATE (
SUM ( 'RE'[Value] ),
'RE'[Informações] = "Contratos Negociados",
DATESBETWEEN (
'RE'[Date],
LASTDATE ( DATEADD ( 'RE'[Date], -13, MONTH ) ),
DATAMAX
)
)
RETURN
RESULT
Best Regards,
Stephen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
*I need some of the last thirteen months' values that is 102.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |