The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
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!
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