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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
I have a measure in a table to show each years value and the YoY changes of the corresponding values.
The measure is defined as follows:
# Calculation_overview_yoy =
VAR _attribution = SELECTEDVALUE(table[Attribute])
VAR _year = SELECTEDVALUE('Column name overview'[Year])
VAR _yoy_last =
CALCULATE(MAX(table[Year]), ALL ())
VAR _yoy_previous = _yoy_last - 1
VAR _last =
CALCULATE(
SUM('table'[Value]),
REMOVEFILTERS('Column name overview'[Year]),
'table'[Year] = _yoy_last
)
VAR _previous =
CALCULATE(
SUM('table'[Value]),
REMOVEFILTERS('Column name overview'[Year]),
'table'[Year] = _yoy_previous
)
VAR _last_0 = COALESCE(_last,0)
VAR _previous_0 = COALESCE(_previous,0)
VAR _yoy =
IF(
_attribution = "Growth",
_last_0 - _previous_0,
DIVIDE(_last_0 - _previous_0, _previous_0)
)
VAR _raw_value = SUM('table'[Value])
RETURN
SWITCH(
TRUE(),
_year = "YoY" && _attribution = "Growth", FORMAT(_yoy, "0.0") & "pp",
_year = "YoY", FORMAT(_yoy, "0.0%"),
_attribution = "Visit before", FORMAT(_raw_value, "0.0"),
_attribution = "Visit after", FORMAT(_raw_value, "0.0"),
_attribution = "Growth", FORMAT(_raw_value, "0,0%"),
_attribution = "Cost", FORMAT(_raw_value, "0.0 €"),
_raw_value
)I tried many different things, but I couldn't manage to make the YoY change of attribution "Growth" be formated as percentage point, e.g. 0.1 pp but it just keep showing percentage change. I have a slicer Country to filter the country. Sample data as follows:
| Attribute | Value | Country | Year |
| Cost | 28 | US | 2025 |
| Cost | 29 | CA | 2024 |
| Cost | 30 | CH | 2024 |
| Cost | 31 | AT | 2024 |
| Cost | 15 | IT | 2024 |
| Cost | 15 | US | 2024 |
| Cost | 15 | CA | 2025 |
| Cost | 15 | CH | 2025 |
| Cost | 32 | AT | 2025 |
| Cost | 33 | IT | 2025 |
| Cost | 34 | PT | 2025 |
| Growth | 0,052631579 | US | 2024 |
| Growth | 0,034482759 | CA | 2024 |
| Growth | 0,025641026 | CH | 2024 |
| Growth | 0,020408163 | AT | 2024 |
| Growth | 0,016949153 | IT | 2024 |
| Growth | 0,014492754 | US | 2025 |
| Growth | 0,012658228 | CA | 2025 |
| Growth | 0,011235955 | CH | 2025 |
| Growth | 0,01010101 | AT | 2025 |
| Growth | 0,009174312 | IT | 2025 |
| Growth | 0,008403361 | PT | 2025 |
| Visit before | 1,9 | US | 2024 |
| Visit before | 2,9 | CA | 2024 |
| Visit before | 3,9 | CH | 2024 |
| Visit before | 4,9 | AT | 2024 |
| Visit before | 5,9 | IT | 2024 |
| Visit before | 6,9 | US | 2025 |
| Visit before | 7,9 | CA | 2025 |
| Visit before | 8,9 | CH | 2025 |
| Visit before | 9,9 | AT | 2025 |
| Visit before | 10,9 | IT | 2025 |
| Visit before | 11,9 | PT | 2025 |
| Visit after | 2 | AT | 2024 |
| Visit after | 3 | US | 2024 |
| Visit after | 4 | CA | 2024 |
| Visit after | 5 | CH | 2024 |
| Visit after | 6 | CH | 2025 |
| Visit after | 7 | US | 2025 |
| Visit after | 8 | IT | 2024 |
| Visit after | 9 | CA | 2025 |
| Visit after | 10 | AT | 2025 |
| Visit after | 11 | IT | 2025 |
| Visit after | 12 | PT | 2025 |
The wished output will be like for example for Country US using the sample data above:
Thanks in advance!
Solved! Go to Solution.
Hi @Touliloop,
Thank you for reaching out to the Microsoft Fabric Forum Community, and special thanks to @amitchandak , @Anand24 and @KarinSzilagyi for prompt and helpful responses.
Replace this part
_year = "YoY" && _attribution = "Growth", FORMAT(_yoy, "0.0") & "pp",
with below one
_year = "YoY" && _attribution = "Growth",
FORMAT ( _yoy * 100, "0.0" ) & " pp",
Thanks & Regards,
Prasanna Kumar
Hi @Touliloop,
Just following up to see if the Response provided by community members were helpful in addressing the issue. if the issue still persists Feel free to reach out if you need any further clarification or assistance.
Best regards,
Prasanna Kumar
Hi @Touliloop,
Just following up to see if the Response provided by community members were helpful in addressing the issue. if the issue still persists Feel free to reach out if you need any further clarification or assistance.
Best regards,
Prasanna Kumar
Hi @Touliloop,
Thank you for reaching out to the Microsoft Fabric Forum Community, and special thanks to @amitchandak , @Anand24 and @KarinSzilagyi for prompt and helpful responses.
Replace this part
_year = "YoY" && _attribution = "Growth", FORMAT(_yoy, "0.0") & "pp",
with below one
_year = "YoY" && _attribution = "Growth",
FORMAT ( _yoy * 100, "0.0" ) & " pp",
Thanks & Regards,
Prasanna Kumar
@Touliloop , first, have a separate date year table.
Then measure
Total = Sum(Table[value])
You can have these measures
This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])
You can have the same aas items of calculation groups
For format, use a dynamic String calculation of measure or a calculation group
https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-dynamic-format-strings
https://www.sqlbi.com/articles/dynamic-format-strings-with-calculation-groups/
Calculation Groups- Measure Slicer, Measure Header Grouping, Measure to dimension conversion. Complex Table display : https://youtu.be/qMNv67P8Go0
Hi @amitchandak thanks for your reply, could you please have a look at the DAX code I attached above? I have several visuals using this method, everything is fine, only when _attribute = 'Growth', the yoy calculation doesn't go by _last - _previous but DIVIDE(_last_0 - _previous_0, _previous_0) as other attributes, I just need to fix this one thing. To rebuild calculation groups will be very time consuming, could you please have a look?🙏
@amitchandak so the question is more like, why
VAR _yoy =
IF(
_attribution = "Growth",
_last_0 - _previous_0,
DIVIDE(_last_0 - _previous_0, _previous_0)
)isn't this working and how to fix it.
Hi @Touliloop,
Try this: FORMAT(_raw_value, "0.0%")
Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!! Proud To Be a Super User !!! |
Hi, thanks for your reply, but it is not to format decimal number to percentage, but to calculate the yoy change of one measure like this
_last_0 - _previous_0
while for other attributes we calculate the yoy changes like this:
DIVIDE(_last_0 - _previous_0, _previous_0)
Hi @Touliloop, the issue is most likely that your clause for the percentage isn't specific enough at the moment, which might overwrite the first condition.
Try to change your last part to this:
From:
_year = "YoY" && _attribution = "Growth", FORMAT(_yoy, "0.0") & " pp",
_year = "YoY", FORMAT(_yoy, "0.0%"),
To:
_year = "YoY" && _attribution = "Growth", FORMAT(_yoy, "0.0") & " pp",
_year = "YoY" && _attribution <> "Growth", FORMAT(_yoy, "0.0%"),
Or as a full Code:
# Calculation_overview_yoy =
VAR _attribution = SELECTEDVALUE(table[Attribute])
VAR _year = SELECTEDVALUE('Column name overview'[Year])
VAR _yoy_last =
CALCULATE(MAX(table[Year]), ALL ())
VAR _yoy_previous = _yoy_last - 1
VAR _last =
CALCULATE(
SUM('table'[Value]),
REMOVEFILTERS('Column name overview'[Year]),
'table'[Year] = _yoy_last
)
VAR _previous =
CALCULATE(
SUM('table'[Value]),
REMOVEFILTERS('Column name overview'[Year]),
'table'[Year] = _yoy_previous
)
VAR _last_0 = COALESCE(_last,0)
VAR _previous_0 = COALESCE(_previous,0)
VAR _yoy =
IF(
_attribution = "Growth",
_last_0 - _previous_0,
DIVIDE(_last_0 - _previous_0, _previous_0)
)
VAR _raw_value = SUM('table'[Value])
RETURN
SWITCH(
TRUE(),
_year = "YoY" && _attribution = "Growth", FORMAT(_yoy, "0.0") & "pp",
_year = "YoY" && _attribution <> "Growth", FORMAT(_yoy, "0.0%"),
_attribution = "Visit before", FORMAT(_raw_value, "0.0"),
_attribution = "Visit after", FORMAT(_raw_value, "0.0"),
_attribution = "Growth", FORMAT(_raw_value, "0,0%"),
_attribution = "Cost", FORMAT(_raw_value, "0.0 €"),
_raw_value
)
hey, thanks for your reply, however it didn't work atfer I modify the last part. YoY "Growth" was still calculated as
DIVIDE(_last_0 - _previous_0, _previous_0)
instead of
_last_0 - _previous_0
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 63 | |
| 51 | |
| 41 | |
| 23 | |
| 18 |
| User | Count |
|---|---|
| 130 | |
| 111 | |
| 48 | |
| 30 | |
| 28 |