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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
jpk564
Frequent Visitor

Creating variance vs. prior period without Date Table?

Hello, due to the structure of my org's fiscal calendar, I'm unable to use a date table to calculate Quarter-over-quarter variance.

 

Can I more easily create a variance measure if I have a prior quarter column, which I could then use as a reference to create a "prior quarter" value column? If so, what would this look like in DAX? Envisioning it as orange below. Thanks!

 

Current QTRPrior QTRCurrent QTR ValuePrior Qtr Value?
Q1-2022Q4-202152
Q2-2022Q1-202285
Q3-2022Q2-202248
Q4-2022Q3-202234
1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @jpk564 

Here are the steps you can refer to :

(1)This is my test data :

vyueyunzhmsft_0-1667871694683.png

(2)We can click "New Column" to create a calculated column to sort in the visual :

Sort_Falg = var _curent_q= CONVERT( RIGHT('Table'[Prior QTR],4) & MID('Table'[Prior QTR],2,1) ,INTEGER)
return
_curent_q

(3)We can create a measure :

Prior QTR Value = var _prior_qtr =SELECTEDVALUE('Table'[Prior QTR])
var _t= FILTER( ALLSELECTED('Table'), 'Table'[Current QTR] = _prior_qtr)
return
SUMX(_t,[Current QTR Value])

(4)Then we can put the filed we need on the visual ,and we can sort the [Current QTR] by the column [Sort_Falg] we create , then wen can meet your need , the result is as follows:

vyueyunzhmsft_1-1667871879175.png

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi , @jpk564 

Here are the steps you can refer to :

(1)This is my test data :

vyueyunzhmsft_0-1667871694683.png

(2)We can click "New Column" to create a calculated column to sort in the visual :

Sort_Falg = var _curent_q= CONVERT( RIGHT('Table'[Prior QTR],4) & MID('Table'[Prior QTR],2,1) ,INTEGER)
return
_curent_q

(3)We can create a measure :

Prior QTR Value = var _prior_qtr =SELECTEDVALUE('Table'[Prior QTR])
var _t= FILTER( ALLSELECTED('Table'), 'Table'[Current QTR] = _prior_qtr)
return
SUMX(_t,[Current QTR Value])

(4)Then we can put the filed we need on the visual ,and we can sort the [Current QTR] by the column [Sort_Falg] we create , then wen can meet your need , the result is as follows:

vyueyunzhmsft_1-1667871879175.png

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

Hi Aniya - thank you very much. What would this look like as a column instead of a measure? I'm looking to have this work if only the current quarter is filtered, which, as a measure, would not show a prior quarter's value. Thank you

 

Prior QTR Value = var _prior_qtr =SELECTEDVALUE('Table'[Prior QTR])
var _t= FILTER( ALLSELECTED('Table'), 'Table'[Current QTR] = _prior_qtr)
return
SUMX(_t,[Current QTR Value])

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.