Forum Discussion
Measure doesn't working with selectedvalue
- 2 years ago
Anonymous Ok, it's more clear. So try with create a new calculated table:
DC_TABLE = DISTINCT(BA_DIARIO[DC])you have to relate this table with BA_DIARIO and use this new table as column in the matrix.Then create another new table:DT_TABLE = DISTINCT(BA_DIARIO[DT_EXEC])but DON'T relate this new one with BA_DIARIO.Then calculate measure like:Sum Switch =VAR BN6 = CALCULATE(SUM(BA_DIARIO[VLR_LANCAMENTO]) / 1000000, DC_TABLE[BA_DIARIO_DC] = "BN 6 + 6")VAR MAXDTEXEC = MAX(DT_TABLE[DT_EXEC])VAR DCMAXEXEC = CALCULATE(SUM(BA_DIARIO[VLR_LANCAMENTO]) /1000000, BA_DIARIO[DT_EXEC] = MAXDTEXEC, ALL(DC_TABLE))VAR CALC =IF(SELECTEDVALUE (DC_TABLE[BA_DIARIO_DC] ) = "△ REAL X BN", BN6 - DCMAXEXEC, SUM(BA_DIARIO[VLR_LANCAMENTO]) / 1000000)RETURN CALCand you achieve the output:BBF
Anonymous can you explain me the desidered output for △ REAL X BN?
BeaBF, I need the difference between last day, and bn 6 + 6, this diferrence need to born in "
In bellow, i have the 30 day in 202407, so the measure needs to perform delta with him and bn 6 + 6:
First line for example the results must be -0.28
The measures [REAL] and [BN] perform this calculation. I just need [REAL] - [BN].
- BeaBF2 years ago
Super User
Anonymous Ok, it's more clear. So try with create a new calculated table:
DC_TABLE = DISTINCT(BA_DIARIO[DC])you have to relate this table with BA_DIARIO and use this new table as column in the matrix.Then create another new table:DT_TABLE = DISTINCT(BA_DIARIO[DT_EXEC])but DON'T relate this new one with BA_DIARIO.Then calculate measure like:Sum Switch =VAR BN6 = CALCULATE(SUM(BA_DIARIO[VLR_LANCAMENTO]) / 1000000, DC_TABLE[BA_DIARIO_DC] = "BN 6 + 6")VAR MAXDTEXEC = MAX(DT_TABLE[DT_EXEC])VAR DCMAXEXEC = CALCULATE(SUM(BA_DIARIO[VLR_LANCAMENTO]) /1000000, BA_DIARIO[DT_EXEC] = MAXDTEXEC, ALL(DC_TABLE))VAR CALC =IF(SELECTEDVALUE (DC_TABLE[BA_DIARIO_DC] ) = "△ REAL X BN", BN6 - DCMAXEXEC, SUM(BA_DIARIO[VLR_LANCAMENTO]) / 1000000)RETURN CALCand you achieve the output:BBF
- BeaBF2 years ago
Super User
Anonymous Ok, so add "+0" in real formula:
BBF
- Anonymous2 years agoNot applicable
- Anonymous2 years agoNot applicable
BeaBF Thx so much, idk why, but the solution comes from this buddy:
DT_TABLE = DISTINCT(BA_DIARIO[DT_EXEC])
when i try to use the max date from BA_DIARIO, and dont from this calculate table, i fall to the initial issue. - BeaBF2 years ago
Super User
Anonymous to not use an external table for DT_EXEC, you can use:
Sum Switch =VAR BN6 = CALCULATE(SUM(BA_DIARIO[VLR_LANCAMENTO]) / 1000000, DC_TABLE[BA_DIARIO_DC] = "BN 6 + 6")VAR MAXDTEXEC = CALCULATE(MAX(BA_DIARIO[DT_EXEC]), ALL(BA_DIARIO[DC]), ALL(DC_TABLE[BA_DIARIO_DC]))VAR DCMAXEXEC = CALCULATE(SUM(BA_DIARIO[VLR_LANCAMENTO]) /1000000, BA_DIARIO[DT_EXEC] = MAXDTEXEC, ALL(DC_TABLE))VAR CALC =IF(SELECTEDVALUE (DC_TABLE[BA_DIARIO_DC] ) = "△ REAL X BN", BN6 - DCMAXEXEC, SUM(BA_DIARIO[VLR_LANCAMENTO]) / 1000000)RETURN CALCBBF