Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ssh529
Regular Visitor

Dynamically subtracting one option from another within the same variable

Hi everyone,

 

I have data for 8 quarters (but the format of the quarter variable in the data is text, not a date).

 

I'm looking to make a dynamic calculation depending on what quarter I pick in the filter, that it will compare this quarters score to the previous quarters score. 

 

ssh529_0-1697219169282.png

For example, here I have clicked Q2 2023 in my filter. The score for Q2 2023 is 11. I now want a KPI that would show +5, since the score for Q1 2023 was 6. 

If I chose Q3 2023 in the filter, I would want the KPI to show -3, since Q2 2023 is 11.

 

I just always want the quarter selected to compare to the quarter before it. But since the quarters are listed as text options within one Quarter variable, I'm not sure how to acheive. 

(This would be a table calculation in Tableau but not sure how to translate here).

 

Thanks! 

1 REPLY 1
marcelsmaglhaes
Super User
Super User

Hey @ssh529 ,

You can try something like the Comparioson Measure bellow. It's a simple starting point that can be refined to meet your specific requirements. Just make sure to replace 'YourTable' with your actual table name and 'YourValueColumn' with the name of the column containing the values you want to compare.

Comparison Measure =
VAR CurrentQuarter = SELECTEDVALUE('YourTable'[Quarter]) // Replace 'YourTable' with your table name
VAR PreviousQuarter =
IF(
CurrentQuarter = "Q1",
"Q4",
CONCATENATE("Q", TEXT(VALUE(RIGHT(CurrentQuarter, 1)) - 1))
)
RETURN
CALCULATE(
SUM('YourTable'[YourValueColumn]), // Replace 'YourValueColumn' with your value column name
'YourTable'[Quarter] = PreviousQuarter
)


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.