Forum Discussion
Pedro_borges
3 years agoRegular Visitor
Create a dynamic return measure in power BI
Hi,
I need to create a dynamic return graph in power BI to calculate return for a given period (Final/First Value), based in one slicer for Fund, and other for date, like below:
I tried to create a measure like the one below, but it gives always 1.
Return Measure = DIVIDE(
SELECTEDVALUE(Resultados[Cota FIC]),CALCULATE(SELECTEDVALUE(Resultados[Cota FIC]), FIRSTDATE(Resultados[Data]))
)
With this measure, this is my graph:
How can I achieve this?
- Anonymous3 years ago
Hi Pedro_borges ,
Please update the formula of measure [Return Measure] as below and check if that is what you want. You can find the details in the attachment.
Return Measure = VAR _mindate = CALCULATE ( MIN ( Resultados[Data] ), ALLSELECTED ( 'Resultados' ) ) VAR _fdCFIC = CALCULATE ( SUM ( 'Resultados'[Cota FIC] ), FILTER ( ALLSELECTED ( 'Resultados' ), 'Resultados'[Data] = _mindate ) ) RETURN DIVIDE ( SUM ( 'Resultados'[Cota FIC] ), _fdCFIC )Best Regards
2 Replies
- AnonymousNot applicable
Hi Pedro_borges ,
Please update the formula of measure [Return Measure] as below and check if that is what you want. You can find the details in the attachment.
Return Measure = VAR _mindate = CALCULATE ( MIN ( Resultados[Data] ), ALLSELECTED ( 'Resultados' ) ) VAR _fdCFIC = CALCULATE ( SUM ( 'Resultados'[Cota FIC] ), FILTER ( ALLSELECTED ( 'Resultados' ), 'Resultados'[Data] = _mindate ) ) RETURN DIVIDE ( SUM ( 'Resultados'[Cota FIC] ), _fdCFIC )Best Regards
- Pedro_borgesRegular Visitor
It worked perfectly. Thank you!