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.
Hello everyone,
I am new to PowerBI.
I have a problem with a measure, here is the source of my measure:
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."),
VAR __PREV_YEAR = CALCULATE([Index kilométrique(km)], DATEADD('Chronologie'[Chronologie].[Date], -1, YEAR))
RETURN
('Index Kilométrique'[Index kilométrique(km)] - __PREV_YEAR))
I would like to cancel the calculation if one of the values is negative to calculate the number of kilometers of the vehicles in my fleet.
How to do?
Thank you in advance for your help!
Solved! Go to Solution.
@ecoflux38170 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."),
VAR __PREV_YEAR = CALCULATE([Index kilométrique(km)], DATEADD('Chronologie'[Chronologie].[Date], -1, YEAR))
VAR __Value = ('Index Kilométrique'[Index kilométrique(km)] - __PREV_YEAR))
VAR __Result = IF(__Value < 0, BLANK(), __Value)
RETURN
__Result
@ecoflux38170 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."),
VAR __PREV_YEAR = CALCULATE([Index kilométrique(km)], DATEADD('Chronologie'[Chronologie].[Date], -1, YEAR))
VAR __Value = ('Index Kilométrique'[Index kilométrique(km)] - __PREV_YEAR))
VAR __Result = IF(__Value < 0, BLANK(), __Value)
RETURN
__Result
Thanks for your solution ! It Works but now, sums are wrong, but it's the sums that interest me the most. I make another post for this other problem.
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.
User | Count |
---|---|
47 | |
24 | |
20 | |
15 | |
13 |
User | Count |
---|---|
51 | |
46 | |
39 | |
19 | |
19 |