Forum Discussion
amaral_diego
1 year agoHelper II
DAX: Conditional in Calculated Column
Hi everyone, I’m working on a calculated column in Power BI and need some help with DAX. Here is what I’m trying to achieve: I have a column called “MOTIVO” with values like “Afastamento”, “Ausênc...
- Anonymous1 year ago
Hi amaral_diego ,
You can try this calculation column.
StatusPolitica = VAR SemanaAtual = WEEKNUM('PRINCIPAL'[DIA], 2) VAR SiglaAtual = 'PRINCIPAL'[SIGLA] VAR MotivoAtual = 'PRINCIPAL'[MOTIVO] VAR Marca = CALCULATE( COUNTROWS('PRINCIPAL'), FILTER( 'PRINCIPAL', WEEKNUM('PRINCIPAL'[DIA], 2) = SemanaAtual && 'PRINCIPAL'[SIGLA] = SiglaAtual && 'PRINCIPAL'[CONTADOR] = 1 ) ) RETURN IF( MotivoAtual IN {"Afastamento", "Férias"}, MotivoAtual, IF( Marca >= 3, "Cumpriu", "Não Cumpriu" ) )If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
1 year agoNot applicable
Hi amaral_diego ,
You can try this calculation column.
StatusPolitica =
VAR SemanaAtual = WEEKNUM('PRINCIPAL'[DIA], 2)
VAR SiglaAtual = 'PRINCIPAL'[SIGLA]
VAR MotivoAtual = 'PRINCIPAL'[MOTIVO]
VAR Marca =
CALCULATE(
COUNTROWS('PRINCIPAL'),
FILTER(
'PRINCIPAL',
WEEKNUM('PRINCIPAL'[DIA], 2) = SemanaAtual &&
'PRINCIPAL'[SIGLA] = SiglaAtual &&
'PRINCIPAL'[CONTADOR] = 1
)
)
RETURN
IF(
MotivoAtual IN {"Afastamento", "Férias"},
MotivoAtual,
IF(
Marca >= 3,
"Cumpriu",
"Não Cumpriu"
)
)
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amaral_diego
1 year agoHelper II
It's worked, thanks a lot!