Forum Discussion
Pier2
Resolver I
2 years agoTranslate calculated column into measure
Hello, I'm trying to translate a calculated column into a measure. Years are integers in the database. VAR idEntreprise = CALCULATE(VALUES( tblEntrepriseDonnees[FKEntreprise])) //idEnter...
- 2 years ago
VAR idEntreprise = SELECTEDVALUE(tblEntrepriseDonnees[FKEntreprise]) VAR anneeCourante = SELECTEDVALUE(tblEntrepriseDonnees[intAnnee]) VAR valeurAnneePrecedente = CALCULATE( SUMX( FILTER(tblEntrepriseDonnees, tblEntrepriseDonnees[intAnnee] = anneeCourante - 1 && tblEntrepriseDonnees[FKEntreprise] = idEntreprise), tblEntrepriseDonnees[sglCapitauxPropres] * tblEntrepriseDonnees[lngMultiple] ), ALLEXCEPT(tblEntrepriseDonnees, tblEntrepriseDonnees[FKEntreprise], tblEntrepriseDonnees[intAnnee]) ) VAR valeurAnneeCourante = CALCULATE( SUMX( FILTER(tblEntrepriseDonnees, tblEntrepriseDonnees[intAnnee] = anneeCourante && tblEntrepriseDonnees[FKEntreprise] = idEntreprise), tblEntrepriseDonnees[sglCapitauxPropres] * tblEntrepriseDonnees[lngMultiple] ), ALLEXCEPT(tblEntrepriseDonnees, tblEntrepriseDonnees[FKEntreprise], tblEntrepriseDonnees[intAnnee]) ) RETURN IF( ISBLANK(valeurAnneePrecedente), BLANK(), (valeurAnneeCourante + valeurAnneePrecedente )/2 )
Pier2
Resolver I
2 years agoVAR idEntreprise = SELECTEDVALUE(tblEntrepriseDonnees[FKEntreprise])
VAR anneeCourante = SELECTEDVALUE(tblEntrepriseDonnees[intAnnee])
VAR valeurAnneePrecedente =
CALCULATE(
SUMX(
FILTER(tblEntrepriseDonnees, tblEntrepriseDonnees[intAnnee] = anneeCourante - 1 && tblEntrepriseDonnees[FKEntreprise] = idEntreprise),
tblEntrepriseDonnees[sglCapitauxPropres] * tblEntrepriseDonnees[lngMultiple]
),
ALLEXCEPT(tblEntrepriseDonnees, tblEntrepriseDonnees[FKEntreprise], tblEntrepriseDonnees[intAnnee])
)
VAR valeurAnneeCourante =
CALCULATE(
SUMX(
FILTER(tblEntrepriseDonnees, tblEntrepriseDonnees[intAnnee] = anneeCourante && tblEntrepriseDonnees[FKEntreprise] = idEntreprise),
tblEntrepriseDonnees[sglCapitauxPropres] * tblEntrepriseDonnees[lngMultiple]
),
ALLEXCEPT(tblEntrepriseDonnees, tblEntrepriseDonnees[FKEntreprise], tblEntrepriseDonnees[intAnnee])
)
RETURN
IF(
ISBLANK(valeurAnneePrecedente),
BLANK(),
(valeurAnneeCourante + valeurAnneePrecedente )/2
)- Anonymous2 years agoNot applicable
Hi,Pier2
We are glad that you have found a solution and are willing to share it, and accept your post for a solution, which is very helpful to our community, and community members who have the same problem as you will find a solution faster. Thank you for your contribution to the community and wish you all the best in your work.
Best Regards,
Leroy Lu