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.
Boa tarde pessoal.
Tenho uma medida que faz uma soma acumulada com os meses anteriores. O que acontece é que tenho meu ano específico, exemplo: 01/04/20 - 31/03/21 = Ano 2020; 01/04/21 - 31/03/22 = Ano 2021 ; 01/04/22 - 31/03/23 = Ano 2022 e assim sucessivamente.Para o cálculo usei a medida (calculate+datesytd). E Datesytd respeita o ano civil. Então ela está somando os meses de janeiro a março de 2022, que no MEU ano corresponde ao ano de 2021.
E consequentemente não irá somar os meses de janeiro a março de 2023, devido a este fato de considerar o ano civil.
Como forma de identificar o meu ano, criei a coluna calculada "Safra" que especifica o ano para os meus periodos informados.Porém ainda não funciona.
Para ilustrar como exemplo realizei filtro do ano 2022, ano filtrado da coluna calculada que criei, como na imagem abaixo.
Os meses de abril e maio devem estar zerados , pois os valores retornados se referem a janeiro, fevereiro, e março de 2022, que no meu ano corresponde ao ano de 2021 como já mencionado.
Alguém já realizou algo nesse sentido?
Solved! Go to Solution.
Hi @hudsonvj ,
I have created a simple sample, please refer to it to see if it helps you.
Create a calculated column first.
year = YEAR(('Table'[Date]))
Then create a measure.
Measure =
VAR _year =
MAX ( 'Table'[year] )
RETURN
IF (
MONTH ( MAX ( 'Table'[Date] ) ) <= 3
&& EDATE ( MAX ( 'Table'[Date] ), -12 ),
MAX ( 'Table'[year] ) - 1,
IF (
MONTH ( MAX ( 'Table'[Date] ) ) >= 4
&& _year = SELECTEDVALUE ( 'Table'[year] ),
MAX ( 'Table'[year] ),
BLANK ()
)
)
Or a column.
column =
VAR _year = ( 'Table'[year] )
RETURN
IF (
MONTH ( ( 'Table'[Date] ) ) <= 3
&& EDATE ( ( 'Table'[Date] ), -12 ),
( 'Table'[year] ) - 1,
IF (
MONTH ( ( 'Table'[Date] ) ) >= 4
&& _year = 'Table'[year],
( 'Table'[year] ),
BLANK ()
)
)
If I have misunderstood your meaning, please provide more details with your desired output and your pbix file without privacy information.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @hudsonvj ,
I have created a simple sample, please refer to it to see if it helps you.
Create a calculated column first.
year = YEAR(('Table'[Date]))
Then create a measure.
Measure =
VAR _year =
MAX ( 'Table'[year] )
RETURN
IF (
MONTH ( MAX ( 'Table'[Date] ) ) <= 3
&& EDATE ( MAX ( 'Table'[Date] ), -12 ),
MAX ( 'Table'[year] ) - 1,
IF (
MONTH ( MAX ( 'Table'[Date] ) ) >= 4
&& _year = SELECTEDVALUE ( 'Table'[year] ),
MAX ( 'Table'[year] ),
BLANK ()
)
)
Or a column.
column =
VAR _year = ( 'Table'[year] )
RETURN
IF (
MONTH ( ( 'Table'[Date] ) ) <= 3
&& EDATE ( ( 'Table'[Date] ), -12 ),
( 'Table'[year] ) - 1,
IF (
MONTH ( ( 'Table'[Date] ) ) >= 4
&& _year = 'Table'[year],
( 'Table'[year] ),
BLANK ()
)
)
If I have misunderstood your meaning, please provide more details with your desired output and your pbix file without privacy information.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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.