Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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.
Solved! Go to Solution.
It seems that you are trying to create a measure in Power BI to calculate the return for a given period based on two slicers, one for Fund and one for date. However, the measure you have created always returns 1.
One possible reason for this issue could be that the SELECTEDVALUE function is not returning the expected value. The SELECTEDVALUE function returns the selected value when a single value is selected in the specified column, otherwise it returns the alternate result or blank if no alternate result is provided. You can try using the MAX or MIN function instead of SELECTEDVALUE to see if it resolves the issue.
Another possible reason could be that the FIRSTDATE function is not returning the expected value. The FIRSTDATE function returns the first date in the current context for the specified column of dates. Make sure that the column you are passing to the FIRSTDATE function contains dates and that the current context is set correctly.
If these suggestions do not resolve your issue, it would be helpful to have more information about your data model and the context in which you are using this measure. You may also want to consider posting your question on a Power BI forum or community where experts can provide more specific guidance.
Retorno =
VAR ValorInicial =
CALCULATE(
MIN(Resultados[Cota FIC]),
FILTER(
ALLSELECTED(Resultados),
Resultados[Data] = MIN(Resultados[Data])
)
)
VAR ValorFinal =
CALCULATE(
MAX(Resultados[Cota FIC]),
FILTER(
ALLSELECTED(Resultados),
Resultados[Data] = MAX(Resultados[Data])
)
)
RETURN
DIVIDE(ValorFinal, ValorInicial)
It seems that you are trying to create a measure in Power BI to calculate the return for a given period based on two slicers, one for Fund and one for date. However, the measure you have created always returns 1.
One possible reason for this issue could be that the SELECTEDVALUE function is not returning the expected value. The SELECTEDVALUE function returns the selected value when a single value is selected in the specified column, otherwise it returns the alternate result or blank if no alternate result is provided. You can try using the MAX or MIN function instead of SELECTEDVALUE to see if it resolves the issue.
Another possible reason could be that the FIRSTDATE function is not returning the expected value. The FIRSTDATE function returns the first date in the current context for the specified column of dates. Make sure that the column you are passing to the FIRSTDATE function contains dates and that the current context is set correctly.
If these suggestions do not resolve your issue, it would be helpful to have more information about your data model and the context in which you are using this measure. You may also want to consider posting your question on a Power BI forum or community where experts can provide more specific guidance.
Retorno =
VAR ValorInicial =
CALCULATE(
MIN(Resultados[Cota FIC]),
FILTER(
ALLSELECTED(Resultados),
Resultados[Data] = MIN(Resultados[Data])
)
)
VAR ValorFinal =
CALCULATE(
MAX(Resultados[Cota FIC]),
FILTER(
ALLSELECTED(Resultados),
Resultados[Data] = MAX(Resultados[Data])
)
)
RETURN
DIVIDE(ValorFinal, ValorInicial)
User | Count |
---|---|
57 | |
21 | |
18 | |
16 | |
12 |
User | Count |
---|---|
85 | |
54 | |
39 | |
21 | |
18 |