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 need to create a measure to subtract two rows from the same column based on different dates. The first value needs to be the selected on the slicer and the second one is always December.
I've tried this way but it's not working. The measure returns the first value based on the slicer and the second returns the value of December, but when together the subtraction doesn't work.
Medida =
VAR mes = SELECTEDVALUE(tabela_data[Mês],0)
Return
CALCULATE(sum(Cockpit[Valor]), Cockpit[Indicador]="FCF ACT YTD",tabela_data[Mês]=mes) CALCULATE(sum(Cockpit[Valor]),Cockpit[Indicador]="FCF OAG YTD",tabela_data[Mês]=12)
I've also tried replacing the variable "mes" for "4" at the first calculate just to see if it works and it does. So I think the issue is related to the use of a variable with a subtraction
Help, please.
Best regard.
Solved! Go to Solution.
Oi @Anonymous ,
Tenta a formula de dezembro assim:
CALCULATE(sum(Cockpit[Valor]), FILTER(ALL(tabela_data), Cockpit[Indicador]="FCF OAG YTD",tabela_data[Mês]=12))
Você precisa ignorar o filtro de data aplicado, caso contrário você não tem nenhum retorno.
Not that, I forgot it here, but I have it on the measure.
Oi @Anonymous ,
Tenta a formula de dezembro assim:
CALCULATE(sum(Cockpit[Valor]), FILTER(ALL(tabela_data), Cockpit[Indicador]="FCF OAG YTD",tabela_data[Mês]=12))
Você precisa ignorar o filtro de data aplicado, caso contrário você não tem nenhum retorno.
With some adjustments this solution works fine.
I just needed to implement a Filter(ALL()) to all the criteria that I want.
Final result:
@Anonymous ,
Não sei como você está fazendo o visual, porém talvez não seja necessário aplicar o filtro no valor atual da linha, apenas no anterior, o proprio SUM(VALOR) já vai fazer isso por você. Isso evita sobrecarga, e só vai sentir se seu modelo tem uma grande quantidade de dados.
ola,
Não funciona porque dá erro de sintaxe. Não posso trazer a coluna Cockpit[Indicador] para dentro do Filter porque no All invoco a tabela_data.
Já tentei por o filtro da Cockpit[Indicador] de fora e fazer dois FILTER, mas tambem não funciona, está-me a devolver um valor que nem sei onde está a ir buscar agora.
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 |
---|---|
47 | |
24 | |
20 | |
15 | |
13 |
User | Count |
---|---|
55 | |
48 | |
43 | |
19 | |
19 |