Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I have a measure to get the percentage difference for year 1 between depletion and exports.
I'm looking to have this measure to do the percentage difference for year 2, year 3 and year 4 also in the one code.
Please find my measure below:
Solved! Go to Solution.
Hi @gbarr12345 ,
Ritaf1983 Thanks for your concern about this case!
And @gbarr12345 , the problem should be with these two measures of yours:
Here I build a sample data myself:
Measures:
Depletion First 12 Months =
CALCULATE(
SUM('Table'[Depletion]),
ALL('Table'),
MONTH('Table'[Date]) >= 1 && MONTH('Table'[Date]) <= 12 && 'Table'[Year] IN VALUES('Table'[Year])
)Exports First 12 Months =
CALCULATE(
SUM('Table'[Exports]),
ALL('Table'),
MONTH('Table'[Date]) >= 1 && MONTH('Table'[Date]) <= 12 && 'Table'[Year] IN VALUES('Table'[Year])
)Year 1 % difference =
VAR Dep = [Depletion First 12 Months]
VAR Exports = [Exports First 12 Months]
RETURN
IF(
Exports <> 0,
DIVIDE(Dep, Exports, 0),
BLANK()
)
And the final output is as below:
If there is still a problem, could you please provide your sample data, and the DAX you created for these two measures, please!
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @gbarr12345 ,
Ritaf1983 Thanks for your concern about this case!
And @gbarr12345 , the problem should be with these two measures of yours:
Here I build a sample data myself:
Measures:
Depletion First 12 Months =
CALCULATE(
SUM('Table'[Depletion]),
ALL('Table'),
MONTH('Table'[Date]) >= 1 && MONTH('Table'[Date]) <= 12 && 'Table'[Year] IN VALUES('Table'[Year])
)Exports First 12 Months =
CALCULATE(
SUM('Table'[Exports]),
ALL('Table'),
MONTH('Table'[Date]) >= 1 && MONTH('Table'[Date]) <= 12 && 'Table'[Year] IN VALUES('Table'[Year])
)Year 1 % difference =
VAR Dep = [Depletion First 12 Months]
VAR Exports = [Exports First 12 Months]
RETURN
IF(
Exports <> 0,
DIVIDE(Dep, Exports, 0),
BLANK()
)
And the final output is as below:
If there is still a problem, could you please provide your sample data, and the DAX you created for these two measures, please!
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
That works! Thank you so much!
Hi @gbarr12345
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |