March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello folks. I have some data which I'm displaying in a stacked column and line chart. My stacked columns are on split by fiscal year on the x axis.
I'm looking for a line to display the difference to the prior FY. I found my way to a new measure, and the application generated this code:
Total % difference from FY2022 =
VAR __BASELINE_VALUE = CALCULATE(SUM('Query1'[Total]), 'Query1'[fiscal year] IN { "FY2020" })
VAR __MEASURE_VALUE = SUM('Query1'[Total])
RETURN
IF(
NOT ISBLANK(__MEASURE_VALUE),
DIVIDE(__MEASURE_VALUE - __BASELINE_VALUE, __BASELINE_VALUE)
)
So far so good, but I only have % difference to a specified FY, where I'm looking for FY-1. Possible values for FY are FY2020 FY2021 FY2022 FY2023 et seq. Seems odd that this functionality is readily available in en excel pivot table but doesn't seem to be here?
Grateful of guidance on how to make that IN {"FY2020"} be dynamic.
Cheers.
Solved! Go to Solution.
Hi @unusdusrname ,
You can update the formula of measure [Total % difference from FY2022] as below and check if it can return your expected result... Please find the details in the attachment.
Total % difference from FY2022 =
VAR _selfyear =
SELECTEDVALUE ( 'Query1'[fiscal year] )
VAR _year =
VALUE ( RIGHT ( _selfyear, 4 ) )
VAR __BASELINE_VALUE =
CALCULATE (
SUM ( 'Query1'[Total] ),
FILTER (
ALLSELECTED ( 'Query1' ),
VALUE ( RIGHT ( 'Query1'[fiscal year], 4 ) ) = _year - 1
)
)
VAR __MEASURE_VALUE =
SUM ( 'Query1'[Total] )
RETURN
IF (
NOT ISBLANK ( __MEASURE_VALUE ),
DIVIDE ( __MEASURE_VALUE - __BASELINE_VALUE, __BASELINE_VALUE )
)
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Thankyou very much Rena.
Hi @unusdusrname ,
You can update the formula of measure [Total % difference from FY2022] as below and check if it can return your expected result... Please find the details in the attachment.
Total % difference from FY2022 =
VAR _selfyear =
SELECTEDVALUE ( 'Query1'[fiscal year] )
VAR _year =
VALUE ( RIGHT ( _selfyear, 4 ) )
VAR __BASELINE_VALUE =
CALCULATE (
SUM ( 'Query1'[Total] ),
FILTER (
ALLSELECTED ( 'Query1' ),
VALUE ( RIGHT ( 'Query1'[fiscal year], 4 ) ) = _year - 1
)
)
VAR __MEASURE_VALUE =
SUM ( 'Query1'[Total] )
RETURN
IF (
NOT ISBLANK ( __MEASURE_VALUE ),
DIVIDE ( __MEASURE_VALUE - __BASELINE_VALUE, __BASELINE_VALUE )
)
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
85 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
157 | |
97 | |
79 | |
69 |