Forum Discussion
PhilippeMuniesa
Resolver I
3 years agoCalculate filter, with format or value
Hello, In a powerPivot table. "CompletContratrem" I have a "Brut" column, decimal number format. And a measure "fx_Brut":=Sum([Brut]) and another "Année" column, Text format example ...
- 3 years agobecause there is contex transition. when you call for the measure inside the filter function, filter provides a row context and the implicite CALCULATE surrounding the measure convert the row context to a filter context. it compares 2021 vs 2021-1, and 2020 vs 2020-1, so blank is returned.This shall work:fx_Brut_N_1:=VAR _value = [Regul_N_1]RETURN calculate([fx_Brut];filter(CompletContratrem;Value(CompletContratrem[Année] )=_value))More info about context transition:
FreemanZ
Super User
3 years agobecause there is contex transition. when you call for the measure inside the filter function, filter provides a row context and the implicite CALCULATE surrounding the measure convert the row context to a filter context. it compares 2021 vs 2021-1, and 2020 vs 2020-1, so blank is returned.
This shall work:
fx_Brut_N_1:=
VAR _value = [Regul_N_1]
RETURN calculate([fx_Brut];filter(CompletContratrem;Value(CompletContratrem[Année] )=_value))
More info about context transition:
- PhilippeMuniesa3 years ago
Resolver I
Thank a lot,
i will read the article on context transition that i don't know.
philippe