Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello everyone,
I created a measure allowing to subtract indexes between 2 dates, but the total displayed is not the correct one, and I would like to have the total of the values displayed in my matrix.
Here are some screenshots to show you how it works.
Table Index kilométrique :
Measure 1 : Index kilométrique(km) = SUM('Index Kilométrique'[Index kilométrique])
Measure 2:
Kilométrage =
Matrice :
I would like finally to make a graph with annual kms for my fleet.
Thanks for your help !
Solved! Go to Solution.
Please try
Kilométrage =
IF (
ISFILTERED ( 'Chronologie'[Chronologie] ),
ERROR ( "Les mesures rapides de Time Intelligence peuvent être regroupées ou filtrées seulement par la hiérarchie de dates ou les colonnes de dates principales fournies par Power BI." ),
SUMX (
VALUES ( 'Table'[Libellé] ),
VAR __PREV_YEAR =
CALCULATE (
[Index kilométrique(km)],
DATEADD ( 'Chronologie'[Chronologie].[Date], -1, YEAR )
)
VAR __CURRENT_YEAR = [Index kilométrique(km)]
VAR __CALCUL = __CURRENT_YEAR - __PREV_YEAR
VAR __RESULTAT =
IF ( __CALCUL < 0, BLANK (), __CALCUL )
RETURN
__RESULTAT
)
)
Hi @ecoflux38170
Not Sure if I fully understand. However, please try
Kilométrage =
IF (
ISFILTERED ( 'Chronologie'[Chronologie] ),
ERROR ( "Les mesures rapides de Time Intelligence peuvent être regroupées ou filtrées seulement par la hiérarchie de dates ou les colonnes de dates principales fournies par Power BI." ),
SUMX (
VALUES ( 'Table'[Libellé] ),
VAR __NEXT_YEAR =
CALCULATE (
[Index kilométrique(km)],
DATEADD ( 'Chronologie'[Chronologie].[Date], 1, YEAR )
)
VAR __CURRENT_YEAR = [Index kilométrique(km)]
VAR __CALCUL = __NEXT_YEAR - __CURRENT_YEAR
VAR __RESULTAT =
IF ( __CALCUL < 0, BLANK (), __CALCUL )
RETURN
__RESULTAT
)
)
Please try
Kilométrage =
IF (
ISFILTERED ( 'Chronologie'[Chronologie] ),
ERROR ( "Les mesures rapides de Time Intelligence peuvent être regroupées ou filtrées seulement par la hiérarchie de dates ou les colonnes de dates principales fournies par Power BI." ),
SUMX (
VALUES ( 'Table'[Libellé] ),
VAR __PREV_YEAR =
CALCULATE (
[Index kilométrique(km)],
DATEADD ( 'Chronologie'[Chronologie].[Date], -1, YEAR )
)
VAR __CURRENT_YEAR = [Index kilométrique(km)]
VAR __CALCUL = __CURRENT_YEAR - __PREV_YEAR
VAR __RESULTAT =
IF ( __CALCUL < 0, BLANK (), __CALCUL )
RETURN
__RESULTAT
)
)
@tamerj1 I've another question for you.
The measurement is correct, but the years are off (see image below)
Here are the readings used:
This means that :
For a statement made in 2017, the mileage corresponds to 2016; however, on the matrix, it is displayed in 2017.
Is there a solution to work around this problem?
Thanks for your help !
Hi @ecoflux38170
Not Sure if I fully understand. However, please try
Kilométrage =
IF (
ISFILTERED ( 'Chronologie'[Chronologie] ),
ERROR ( "Les mesures rapides de Time Intelligence peuvent être regroupées ou filtrées seulement par la hiérarchie de dates ou les colonnes de dates principales fournies par Power BI." ),
SUMX (
VALUES ( 'Table'[Libellé] ),
VAR __NEXT_YEAR =
CALCULATE (
[Index kilométrique(km)],
DATEADD ( 'Chronologie'[Chronologie].[Date], 1, YEAR )
)
VAR __CURRENT_YEAR = [Index kilométrique(km)]
VAR __CALCUL = __NEXT_YEAR - __CURRENT_YEAR
VAR __RESULTAT =
IF ( __CALCUL < 0, BLANK (), __CALCUL )
RETURN
__RESULTAT
)
)
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
25 | |
10 | |
7 | |
6 | |
6 |
User | Count |
---|---|
30 | |
11 | |
11 | |
10 | |
6 |